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

  1. The empty set, set(), is included in the output;

  2. The full set {'one', 'two', 'three'} is included in the output;

  3. The duplicated input element "three" is treated as if it appeared only once;

  4. The order in which the subsets are generated is not defined.

Indices and tables