[Python-Dev] PEP 380 (yield from a subgenerator) comments

Guido van Rossum guido at python.org
Sat Mar 28 23:08:43 CET 2009


On Sat, Mar 28, 2009 at 4:37 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>
>>>> I think in either case a check in
>>>> PyIter_Next() would cover most cases
>>
>>> If that's acceptable, then the check might as well
>>> be for None as the StopIteration value, and there's
>>> no need for a new exception.
>>
>> I don't understand this.
>
> Maybe I misunderstood what you were saying. What
> check were you suggesting to perform in PyIter_Next?

I now realize what you were saying. You said effectively "the check
added to PyIter_Next() might as well check whether the value attribute
of the StopIteration is not None", but due to PyCon tiredness last
night my brain's English parser didn't come up with any meaningful
parse of what you wrote.

But it's been answered already -- we can't change the meaning of
StopIteration() with a value unequal to None, so it has to be a
separate exception, and it should not derive from StopIteration.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list