import itertools
def powerSet(items):
'''
items : a list
returns all possible combinations of the items
'''
return itertools.chain.from_iterable(itertools.combinations(items,r)
for r in range(len(items)+1))
items = [1,2,3]
If I try
print(powerSet(items))
it returns
<itertools.chain object at 0x113e43588>
but if I try
print(list(powerSet(items)))
it gives me the list of all subsets.
Why is that?