does python have useless destructors?

Roger Binns rogerb at rogerbinns.com
Fri Jun 11 02:24:07 EDT 2004


Peter Hansen wrote:
> Do _you_ have a solution?  If you do and it really works,
> it seems to me unlikely it would be ignored...

I would do the same thing that shutdown does.  Run
the destructors, but don't delete the underlying
memory.  Set all the fields to None (just as shutdown
points modules at None).  Finally in a second round
actually free the memory.

Or throw an exception if a situation is encountered
where the destructor can't be run because of various
constraints.  I would rather know about it and fix
my code, than just have things silently fail/leak.

Roger





More information about the Python-list mailing list