[Python-Dev] pre-PEP: Resource-Release Support for Generators
Guido van Rossum
guido at python.org
Tue Aug 26 21:57:59 EDT 2003
> 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?
The problem is that the language definition doesn't define *when* GC
happens, if at all. E.g. in Jython this depends on the Java GC. And
even in CPython, it's easily conceivable that an accidental cycle in
the user data structures prevents collection. So there is a need for
explicit control in some cases.
> Back to lurking,
Good idea. :-)
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list