The problem lies in the last for loop block. It should pop the expo list to complete vanishing but it stops at length 32. I cannot imagine why.
I tried the list.pop method and also as shown the del operator. Both raise the same error.
def generator(): # generator which generates like 2,4,8,16 -> 2 to the power of x
list = range(1,65)
for i in list:
yield 2**i
mygen = generator() # generator object
expo = [] # empty list for the exponential values
for i in mygen: # for loop to put the values of the genertor in list form
expo.append(i)
print(expo)
for i in expo: # attempt to delete the last element, but stops at list with length 32
del expo[-1]
print(expo)
I expected that the list would get deleted as it was build stepwise. It should become [] but becomes len(expo)=32 .
So why does it stop ?