super not working in __del__ ?
Fredrik Lundh
fredrik at pythonware.com
Wed Feb 16 12:45:50 EST 2005
Christopher J. Bottaro wrote:
> 2 Questions...
> 1) Why does this never happen in C++? Or does it, its just never happened
> to me?
C++ uses an entirely different allocation model. if you think in C++ when
you write Python, you will write bad Python.
> 2) I can understand random destruction of instantiated objects, but I find
> it weird that class definitions (sorry, bad terminology) are destroyed at
> the same time. So __del__ can't safely instantiate any classes if its
> being called as a result of interpreter shutdown? Boo...
please read the essay. and fixing your terminology may help you understand
how things work (hint: class creates a class object and binds it to a name, like
any other assignment. class objects are no different from other objects)
(btw, if you don't know exactly why you need to use __del__, chances are that
you don't need to use it. __del__ is a finalizer, not a destructor.).
</F>
More information about the Python-list
mailing list