[Python-Dev] PEP 479: Change StopIteration handling inside generators
Chris Angelico
rosuav at gmail.com
Fri Nov 21 03:33:15 CET 2014
On Fri, Nov 21, 2014 at 10:34 AM, Chris Angelico <rosuav at gmail.com> wrote:
> 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.
Examples and explanatory text added.
https://raw.githubusercontent.com/Rosuav/GenStopIter/master/pep-0479.txt
ChrisA
More information about the Python-Dev
mailing list