[Python-ideas] Yield-From: Finalization guarantees

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 26 09:36:58 CET 2009


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.

> Since the main advantage that the new expression has over simple
> iteration is delegating send() and throw() correctly, and I'm suggesting
> that shared iterators and those two methods don't mix, perhaps this
> whole issue can be set aside?

Sounds good to me.

-- 
Greg




More information about the Python-ideas mailing list