is there anybody using __del__ correctly??

Kay Schluehr kay.schluehr at gmx.net
Sun Aug 12 03:26:09 EDT 2007


On Aug 10, 9:36 am, Michele Simionato <michele.simion... at gmail.com>
wrote:

> P.S. BTW, I should mention that if you search comp.lang.python for
> __del__
> you will find hundreds of people who were bitten by __del__, so I
> usually give
> advices such as "you should never __del__ in your code". If I am wrong
> in
> giving this advice, please let me know!

I wish we had constructive proofs of cycle freedom and appropriate
warnings - much more then __del__ freedom [1].

Well, we discussed a retro computing example yesterday where some guy
needed to close a generator and release resources, still working with
Python 2.4.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/3f789096bded17e7/?hl=en#

We did it both wrong initially and constructed a reference cycle. Now
I keep my fingers crossed that my most recent solution using __del__
works, because I like it :)

[1] While I'm using Python on and off I feel subconsciously attracted
by the latest Haskell mania and start to dream alike. Maybe I should
visit a shrink or a shaman?




More information about the Python-list mailing list