__del__ and saving/restoring dc

Robin Dunn robin at alldunn.com
Wed Sep 19 22:29:57 PDT 2007


David Montgomery wrote:

> But I was under the impression that one shouldn't
> rely on __del__ for this kind of thing in python, because
> you don't really know when __del__ is going to be
> called. 

At least in CPython it will be called as soon reference count goes to 
zero.  So if there is only one reference __del__ will be called as soon 
as it goes out of scope, just like the destructor of a C++ object on the 
stack.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wx-users mailing list