[Python-Dev] PEP 479: Change StopIteration handling inside generators

Chris Angelico rosuav at gmail.com
Fri Nov 21 00:34:06 CET 2014


On Fri, Nov 21, 2014 at 6:36 AM, Guido van Rossum <guido at python.org> wrote:
> It would also be useful if we could extend the PEP with some examples of the
> various categories of fixes that can be applied easily, e.g. a few examples
> of "raise StopIteration" directly in a generator that can be replaced with
> "return" (or omitted, if it's at the end); a few examples of situations
> where "yield from" can supply an elegant fix (and an alternative for code
> that needs to be backward compatible with Python 3.2 or 2.7); and finally
> (to be honest) an example of code that will require being made more
> complicated.
>
> Oh, and it would also be nice if the PEP included some suggested words that
> 3rd party educators can use to explain the relationship between
> StopIteration and generators in a healthier way (preferably a way that also
> applies to older versions).
>
> Chris, are you up to drafting these additions?

Sure, no problem. Will knock something up shortly.

ChrisA


More information about the Python-Dev mailing list