[PyKDE] destructor not getting called?

Greg Fortune lists at gregfortune.com
Fri Nov 8 11:25:01 GMT 2002


On Friday 08 November 2002 01:59 am, Fredrik Juhlin wrote:
> On Fri, 2002-11-08 at 10:34, Greg Fortune wrote:
> > On Friday 08 November 2002 12:44 am, you wrote:
> > > The reason you're having problems is most likely because there is no
> > > such thing as a destructor in Python. I assume that you, like many
> > > before you, are treating the __del__() method as a destructor but the
> > > reality is there is no guarantee that __del__() will be called on
> > > program exit. The Python Language Reference recommends that you only
> > > use
> >
> > ????  ack, where did you find information implying that __del__ might not
> > get called on program exit?  From my understanding, __del__ just wouldn't
> > be called until the reference count reaches 0 and the garbage collection
> > cycle executes.  That, of course, should happen for every object at
> > program exit... If it doesn't, that would seem like a Python bug.
>
> I got it from the Python Language Reference (a convenient link was
> included in my last mail and below). To quote:
> "It is not guaranteed that __del__() methods are called for objects that
> still exist when the interpreter exits."
> Wether or not it is a bug I'm really not qualified to say.

Looks like I skimmed right over that to the Warning section and figured 
that's what you were talking about.  I see it now and feel just a tad silly 
;o)  If it's a bug, it's a documented one...

>
> > > __del__() methods to "do the absolute minimum needed to maintain
> > > external invariants". See
> > > http://www.python.org/doc/current/ref/customization.html for more
> > > information.
>
> //Fredrik
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde




More information about the PyQt mailing list