Unbound names in __del__

Dieter Maurer dieter at handshake.de
Sat Jun 18 14:48:11 EDT 2005


Peter Hansen <peter at engcorp.com> writes on Fri, 17 Jun 2005 08:43:26 -0400:
> ...
> And I don't recall the last time I saw a __del__ in third-party code I
> was examining.
> 
> 
> What's your use case for del?

I had to use one a few days ago:

     To call the "unlink" method of a "minidom" object when
     its "container" is destroyed.

     It would have been possible to let the cyclic garbage
     collector find and eliminate the cyclic "minidom" objects.
     But, DOMs may be large and I create lots of them in
     a short time (each in its own container)...


Dieter




More information about the Python-list mailing list