Advice needed on __del__
phil
phillip.watts at anvilcom.com
Mon May 9 15:32:36 EDT 2005
>
> Python makes no guarantees whatsover about when and how to
> run __del__, so relying on it to remove user-visible resources is a
> rather bad idea.
>
What does that mean? Is it a destructor or not?
I create thousands of instances of objects in a geometry
instruction program and rely heavliy on __del__ to do its
thing. For instance when I am rotating objects, I delete and
recreate somtimes hundreds of times. Works so far.
What worries me about the above statement is two things:
1. I'm using 2.3.4. Am I in for some nasty surprise later?
2. If Python is an oop language, meaning instances of classes
are essential, then a reliable destructor method is essential.
If I am skating on thin ice here, please tell me for I have some
complex software invested in __del__.
By the way, I understand that __del__ is only called when the last
reference to an instance is deled. That's fine, if consistent.
More information about the Python-list
mailing list