[Python-Dev] pre-PEP: Resource-Release Support for Generators

Ronald Oussoren oussoren at cistron.nl
Wed Aug 27 00:36:02 EDT 2003

On Tuesday, 26 August 2003, at 22:50, Guido van Rossum wrote:

> Another comment on Samuele's PEP: It is sort of sad that the *user* of
> a generator has to know that the generator's close() must be called.
> Normally, the beauty of using a try/finally for cleanup is that your
> callers don't need to know about it.  But I see no way around this.

I have no idea what the issues are w.r.t. cleanup for generators, but 
wouldn't it be more natural to make sure that the finally clause would 
be executed when the generator is garbage collected?

Back to lurking,

More information about the Python-Dev mailing list