def powerset(iterable):
    s = list(iterable)
    for chars in itertools.chain.from_iterable(
        itertools.combinations(s, r) for r in range(1, len(s)+1)
        ):
        yield ''.join(chars)
powerset('abc') -> a b c ab ac bc abc
dataset/ETHPy150Open rspivak/slimit/src/slimit/scope.py/powerset