While using a generator, I noticed that if execute the following code, it throws a StopIteration exception :
evenIntegers = even_integers_generator(10)
print(list(evenIntegers))
for i in range(5):
print(next(evenIntegers))
Does anyone know why? I thought that the pointer for the object might be at the end of the iterator but I also tried printing the first item only and it still throws the same error.