I wrote this code to try to get the powerset of a python list, and return it as a list of lists, but for some reason it is not working, because it gives a 'NoneType' object has no attribute 'append'. I cannot figure out why though, can anyone help?
def subsetHelper(current_subset, result, nums):
if not nums:
result.append(current_subset)
else:
subsetHelper(current_subset.append(nums[0]), result, nums[1:])
subsetHelper(current_subset, result, nums[1:])
def subsets(nums):
result = []
subsetHelper([], result, nums)
print nums