__del__ problem - would adopting Garbage Collection fix this?

Just van Rossum just at letterror.com
Thu Apr 20 02:45:54 EDT 2000


At 4:50 AM +0000 20-04-2000, Neil Schemenauer wrote:
>When garbage is found by the collector (ie. reference cycles not
>reachable from Python), all objects reachable from __del__
>methods are moved into a separate set.  This is what I call
>uncollectable garbage.  Uncollectable instances are currently
>added to a global list of uncollectable objects reachable from
>within Python.  If the programmer creates such garbage it is up
>to them to deal with it.
>
>The bottom line is don't add __del__ methods to objects that form
>cycles.  It is, however, okay to reference objects with __del__
>methods from objects involved in reference cycles.

Hm, wouldn't it be better to collect cyclic objects with __del__ anyway,
and just not call __del__? Possibly printing something to stderr, similarly
to when an exception occurs within a __del__ method.

Just






More information about the Python-list mailing list