powerset

sknano.core.powerset(iterable)[source] [edit on github][source]

Yields all possible subsets of the iterable.

Examples

>>> from sknano.core import powerset
>>> list(powerset([1, 2, 3]))
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]