[Python-Dev] Design question: call __del__ for cyclical garbage?

Tim Peters tim_one@email.msn.com
Sat, 4 Mar 2000 23:56:58 -0500


[Tim]
> ...If a trash cycle contains a finalizer (my, but that has to be rare.
> in practice, in well-designed code!),

[Moshe Zadka]
> This shows something Tim himself has often said -- he never programmed a
> GUI. It's very hard to build a GUI (especially with Tkinter) which is
> cycle-less, but the classes implementing the GUI often have __del__'s
> to break system-allocated resources.
>
> So, it's not as rare as we would like to believe, which is the reason
> I haven't given this answer.

I wrote Cyclops.py when trying to track down leaks in IDLE.  The
extraordinary thing we discovered is that "even real gc" would not have
reclaimed the cycles.  They were legitimately reachable, because, indeed,
"everything points to everything else".  Guido fixed almost all of them by
explicitly calling new "close" methods.  I believe IDLE has no __del__
methods at all now.  Tkinter.py currently contains two.

so-they-contained-__del__-but-weren't-trash-ly y'rs  - tim