def powerset(L): if L == []: return [[]] else: return powerset(L[1:]) + \ [x + [L[0]] for x in powerset(L[1:])]