Help with generators outside of loops.
David Eppstein
eppstein at ics.uci.edu
Wed Dec 8 14:14:28 EST 2004
In article <Dzytd.477960$35.20534457 at news4.tin.it>,
Andrea Griffini <agriff at tin.it> wrote:
> Isn't the handling of StopIteration confined in the very moment of
> calling .next() ? This was what I expected... and from a simple test
> looks also what is happening...
Not if someone farther back in the call chain is looking for
StopIteration. Which could be the case if the call chain includes a
for-loop that is calling the next() method of another generator.
--
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list