A Python Generator of power sets¶
This is documentatation for version 0.1.3 of powerset-generator package, a simply python package for creating power sets of a collection.
Installation¶
To use powerset generator, first install it with pip
$ pip install powerset-generator
Example¶
The root (and so far only) module is powerset_generator,
providing the only function, subsets().
from powerset_generator import subsets
for e in subsets( ["one", "two", "three", "three"])]:
print(e)
should produce a result similar to
set()
{'one'}
{'three'}
{'two'}
{'one', 'three'}
{'one', 'two'}
{'three', 'two'}
{'one', 'three', 'two'}
Note
The empty set,
set(), is included in the output;The full set
{'one', 'two', 'three'}is included in the output;The duplicated input element
"three"is treated as if it appeared only once;The order in which the subsets are generated is not defined.