[Python-ideas] Revised**7 PEP on Yield-From
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Mar 21 22:43:54 CET 2009
Jacob Holm wrote:
> # This causes a StopIteration in iterator.next(). After grabbing
> # the value in the "except StopIteration" clause of the PEP
> # expansion, the "finally" clause calls iterator.close().
Okay, I see what you mean now. That's a bug in the expansion.
Once an iterator has raised StopIteration, it has presumably
already finalized itself, so calling its close() method
shouldn't be necessary, and I hadn't intended that it should
be called in that case.
I'll update the PEP accordingly.
--
Greg
More information about the Python-ideas
mailing list