powerset

iteration_utilities.powerset(iterable)

Create all possible sets of values from an iterable.

Parameters:

iterable : iterable

Iterable for which to create a powerset.

Returns:

powerset : generator

An iterable containing all powersets as tuple.

Examples

>>> from iteration_utilities import powerset
>>> list(powerset([1,2,3]))
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]