does python have useless destructors?

Roger Binns rogerb at rogerbinns.com
Sun Jun 13 18:55:50 CEST 2004


Martin v. Löwis wrote:
> "the same thing as shutdown" means that you clear out
> all modules.

I meant that during shutdown the modules are forcibly
garbage collected, and to a certain extent Python
treats their names like weak references (the names
don't disappear, the object they point to goes
to None).

My comment was in the context of what should the GC
do when it is faced with a "hard" problem, such as
cycles and objects with __del__ methods.  At the moment
CPython gives up.

I was suggesting that it could instead do something
like keep names but point fields/objects at None
instead.  CPython doesn't give up during shutdown.

Roger





More information about the Python-list mailing list