Here's a powerset creator that should work for any iterable. It is easily changed to a generator, which might be wise if your iterables are of any length. def subsets(s): result = list( [] ) for xi in s: result += list( subset+[xi] for subset in result ) return result Cheers, Alan Isaac