__del__ methods

Jason Baker amnorvend at gmail.com
Fri Jul 18 21:26:35 CEST 2008


On Jul 18, 2:10 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Fri, 18 Jul 2008 11:31:20 -0700, Jason Baker wrote:
> > I have a class that I need to do some finalization on when it dies.  I
> > know I can use the __del__ method, but I seem to recall that it
> > impedes garbage collection.  Is this the case?
>
> `__del__()` is not a deterministic destructor.  So forget about reliable
> automatic clean up.  Do it yourself with an explicit call to a `close()`
> method or something like that.
>
> Ciao,
>         Marc 'BlackJack' Rintsch

I don't necessarily need deterministic cleanup.  And I plan on doing
something like a close() method as well.  But I'd just like to make
sure nothing slips between the cracks.  :)



More information about the Python-list mailing list