from functools import reduce
return 1 - reduce(operator.mul, ps)
Algorithm to get every possible subset of a list, in order of their product, without building and sorting the entire list (i.e Generators)