[Python-3000] Removing __del__

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Sep 26 15:15:17 CEST 2006


"Giovanni Bajo" <rasky at develer.com> writes:

> Guido was proposing a solution with __del__ and CT, which
> approximately worked this way:
>
> - When a CT is detected, any __del__ method is invoked once per
> instance, in random order.

This means that __del__ may attempt to use an object which has already
had its __del__ called.

> Since we are discussing Py3k here, I believe it is the right time to revive
> this discussion. The __close__ proposal I'm backing (sumed up in this mail:
> http://mail.python.org/pipermail/python-3000/2006-September/003892.html) is
> pretty similar to how Guido was proposing to modify __del__.

"1) call __close__ on the instances *BEFORE* dropping the references.
The code in __close__ could break the cycle itself."

Same problem as above.

Note that the problem is solvable when the subset of links in these
objects which is needed during finalization doesn't contain cycles.
But the language implementation can't know *which* links are these.

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


More information about the Python-3000 mailing list