On Fri, Jul 18, 2008 at 2:31 PM, Jason Baker <[EMAIL PROTECTED]> wrote: > I have a class that I need to do some finalization on when it dies. I > know I can use the __del__ method, but I seem to recall that it > impedes garbage collection. Is this the case?
Yes. "Objects that have __del__() methods and are part of a reference cycle cause the entire reference cycle to be uncollectable, including objects not necessarily in the cycle but reachable only from it. Python doesn't collect such cycles automatically because, in general, it isn't possible for Python to guess a safe order in which to run the __del__() methods." The uncollectable objects are stored in gc.garbage and will not be freed until their reference cycles are broken and they are removed from that list. http://docs.python.org/lib/module-gc.html -Miles -- http://mail.python.org/mailman/listinfo/python-list