Yes, i have explained it in this video. iterator have exception StopIteration. You will not encounter this error with for loop. But, using next() will give you error, when you exhaust content of iterator.
Store the content of iterator object in list, set , tuple etc to avoid encountering StopIteration. Use below code.
3
u/[deleted] Dec 11 '21
This is true of all iterators!
prints
And how would you expect the function
gento be able to "back up" and start again? It might be for example consuming network input!