[Python-ideas] Yield-From: GeneratorExit?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 24 00:07:13 CET 2009

Bruce Frederiksen wrote:

> But non-generators don't have a close (or throw) method.  They lack the 
> concept of "finalization".

Any object could require explicit finalization in the
absence of refcounting, so "close" isn't peculiar to

> Should the delegating generator, then, be calling close rather throw for 
> GeneratorExit so that the RuntimeError is raised closer to cause of the 
> exception?  Or does this violate the "inlining" goal of the current PEP?

Yes, it would violate the inlining principle.


More information about the Python-ideas mailing list