[Python-ideas] Yield-From: Finalization guarantees

Nick Coghlan ncoghlan at gmail.com
Thu Mar 26 11:38:29 CET 2009

Greg Ewing wrote:
> Nick Coghlan wrote:
>> I'm not so sure about that - we don't do it for normal iteration, so why
>> would we do it for the new expression?
> Because of the inlining principle. If you inline a
> subgenerator, the result is just a single generator,
> and closing it finalizes the whole thing.

That makes perfect sense to me as a justification for treating
GeneratorExit the same as any other exception (i.e. delegating it to the
subgenerator). It doesn't lead me to think that the semantics ever need
to involve calling close().


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list