Python equivalent of C++'s virtual destructors?

Bjorn Pettersen bjorn at roguewave.com
Tue Aug 1 14:29:49 EDT 2000


david_ullrich at my-deja.com wrote:
[snip]

>  "Note that it is possible (though not recommended!) for the
> __del__ method to postpone destruction of the instance by
> creating a new reference to it. It may then be called at a
> later time when this new reference is deleted. It is not
> guaranteed that __del__ methods are called for objects
> that still exist when the interpreter exits."
> 
> The last sentence is news to me - it's not clear to me
> what a person _is_ supposed to do to guarantee things
> get cleaned up when the interpreter exits.

Avoiding, or explicitly deleting globals should do it... Of course, if
you're ever confused do it explicitly.

-- bjorn




More information about the Python-list mailing list