does python have useless destructors?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Jun 13 19:40:22 CEST 2004


On Sun, 13 Jun 2004 10:24:14 -0700, David Turner wrote:

> Objects that define __del__ shall have a reference count, which is
> incremented when names are bound to the object and decremented when
> those names go out of scope.  The __del__ method is called when the
> reference count reaches zero.  This mechanism is orthogonal to garbage
> collection.

It's not statically known which variables hold objects which define __del__.
This implies that you must walk over all local variables of all function
activations, in addition to GC overhead, and you must manage reference
counts in all assignments. I'm afraid it's unacceptable.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/




More information about the Python-list mailing list