Python equivalent of C++'s virtual destructors?

Erik Max Francis max at alcyone.com
Tue Aug 1 14:45:33 EDT 2000


david_ullrich at my-deja.com wrote:

>    Can you recall where you read this and exactly what it said?
> In the docs (under "Basic Customization") it says
> 
> "__del__(self) Called when the instance is about to be destroyed.
> If a base class has a __del__ method the derived
> class's __del__ method must explicitly call it to ensure
> proper deletion of the base class part of the instance.
> e.g. ''BaseClass.__del__(self)''."
> 
> which would seem to indicate it's not a no-no at all.

I did some research after asking the question, and I realized that my
impression (about explicit calls to __del__ being bad) was from the FAQ,
but it was from an entirely different context -- namely, trying to free
up circular references by explicitly calling __del__ (which indeed is a
no-no).

Thanks.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ A man can stand a lot as long as he can stand himself.
\__/ Axel Munthe
    Fat Boy and Little Man / http://www.fatboyandlittleman.com/
 Watch Fat Boy and Little Man go about their antics.



More information about the Python-list mailing list