On Mon, Nov 24, 2014 at 4:21 PM, Alexander Belopolsky < alexander.belopolsky at gmail.com> wrote: > > On Wed, Nov 19, 2014 at 3:10 PM, Guido van Rossum <guido at 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. > Good catch. It has to be #1 because the generator object doesn't retain exception state. I am behind with updating the PEP but I promise I won't mark it as Accepted without adding this, the transition plan, and a discussion of some of the objections that were raised. -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20141124/6bebc3cd/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4