Help with generators outside of loops.

David Eppstein eppstein at
Wed Dec 8 20:14:28 CET 2004

In article <Dzytd.477960$35.20534457 at>,
 Andrea Griffini <agriff at> 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

More information about the Python-list mailing list