On Wed, Nov 19, 2014 at 3:10 PM, Guido van Rossum <gu...@python.org> wrote:

> There's a new PEP proposing to change how to treat StopIteration bubbling
> up out of a generator frame (not caused by a return from the frame). The
> proposal is to replace such a StopIteration with a RuntimeError (chained to
> the original StopIteration), so that only *returning* from a generator (or
> falling off the end) causes the iteration to terminate.


I think the PEP should also specify what will happen if the generator's
__next__() method is called again after RuntimeError is handled.  The two
choices are:

1. Raise StopIteration (current behavior for all exceptions).
2. Raise RuntimeError (may be impossible without gi_frame).

I think choice 1 is implied by the PEP.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to