[Python-ideas] Yield-From: Finalization guarantees

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 27 12:08:25 CET 2009

Nick Coghlan wrote:

> As you say, it does make it easier to write a non-generator delegation
> target, since implementing close() for finalisation means not having to
> deal with the vagaries of correctly reraising exceptions.

It also means that existing things with a close
method, such as files, can be used without change.

Having a close method is a fairly well-established
way to make an iterator explicitly finalizable,
whereas having a throw method isn't.


More information about the Python-ideas mailing list