[Python-ideas] Change how Generator Expressions handle StopIteration

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Nov 3 22:38:49 CET 2014


Guido van Rossum wrote:

> FWIW the implementation of my proposal is easy to describe (which the 
> Zen approves of): when a StopIteration leaves a frame, replace it with 
> some other exception (either a new, custom one or maybe just 
> RuntimeError), chaining the original StopIteration.

Wouldn't that break all existing iterators whose next() method
is implemented in Python? Since the code that catches the
StopIteration is always in a different frame then.

Or are you only talking about generator frames here, not
frames in general?

-- 
Greg


More information about the Python-ideas mailing list