[Python-ideas] Yield-From: Finalization guarantees

Jacob Holm jh at improva.dk
Thu Mar 26 00:40:46 CET 2009

Greg Ewing wrote:
> Jacob Holm wrote:
>> It fails to handle the case where the throw raises a StopIteration 
>> (or there is no throw method and the thrown exception is a 
>> StopIteration).
> No, I think it does the right thing in that case. By the
> inlining principle, the StopIteration should be thrown
> in like anything else, and if it propagates back out,
> it should stop the delegating generator, *not* the
> subiterator.
But if you throw another exception and it is converted to a 
StopIteration by the subiterator, this should definitely stop the 
subiterator and get a return value. Or?

- Jacob

More information about the Python-ideas mailing list