Advice needed on __del__

stasz foo at bar.org
Tue May 10 05:05:51 EDT 2005


On Mon, 09 May 2005 22:49:06 -0300, André Roberge wrote:

> Scott David Daniels wrote:
>> André Roberge wrote:
>> 
>>>...  Each time I refresh the screen, I could
>>>force that call, then check to see if Evil has been
>>>destroyed by Python, which would give me the information
>>>I need to destroy Evil_twin behind the scene myself -
>>>which is what I am really after.
Wouldn't it be better if the robots draw themselfs onto the canvas?
That way you don't have to worry about deletion, a robot would only
draw itself when he's has to.
So perhaps it's an idea to delegate the drawing of stuff to the objects
themself rather then in the 'visibleworld' class.

> However (famous last words follow...) I feel it's not going to bite me
> this time.  The main reason is that, when Evil is gone, before the
> screen gets updated, lots of drawing calls and wxYield() calls are made,
> so that __del__ has lots of time to get called.
Your relying on something that *will* bite you, the question is rather
*when* will it bite you :-)

IMHO, the approach to rely on Python to do your dirty work and then
checks if it's done seems a bit VB to me :-)


Stas Zytkiewicz





More information about the Python-list mailing list