PlasmaCalcs.tools.math.nonempty_product
- PlasmaCalcs.tools.math.nonempty_product(iterable)
- returns the product of all elements in iterable; iterable must have at least 1 element.Crash with TypeError if iterable has no elements.Does not assume that 1 is the multiplicative identity.E.g. does l[0] * l[1] * … * l[-1], where l = list(iterable).(This is useful when using non-numeric objects which have defined __mul__ method.)Equivalent to functools.reduce((lambda x,y: x*y), iterable).