I’m looking for a Python function or method that can handle both additive and multiplicative combinations of parameters.
Specifically, I want to first apply addition to certain parameters and then apply multiplication to the results of those additions with other parameters.
Example:
>> f = {a:[a1, a2], b:[b1, b2], c: [c1, c2]}
>> comb = "+x+"
>> iter = func(f, comb)
>> for i in iter:
>> print(i)
(a1, b1, c1)
(a1, b2, c1)
(a2, b1, c2)
(a2, b2, c2)
for-loop could solve this problem, but it’s not pythonic. Does Python have a built-in function for this, or is there a recommended approach to achieve this?
Any example code would be highly appreciated.
😉
1