I am fed up with Python GUI toolkits...

sturlamolden sturlamolden at yahoo.no
Wed Jul 20 16:41:54 CEST 2011


On 20 Jul, 13:04, Adam Tauno Williams <awill... at whitemice.org> wrote:

> > 3. Instances of extension types can clean themselves up on
> > deallocation. No parent-child ownership model to mess things up. No
> > manual clean-up. Python does all the reference counting we need.
>
> NEVER GOING TO HAPPEN.  UI's don't work that way.  They are inherently
> hierarchical.  Just get over it.

Swing relies on the Java GC. Tkinter also does this correct.

A hierarchy is nice for event processing an layout management, but not
for memory mangement.

C resources should be freed by Python calling tp_dealloc, not by the
parent calling a .destroy() method on it's children.

Python is not C++, so we have a method to automatically reclaim C
resources. I don't want a toolkit to deallocate objects while Python
still holds references to them (PyQt) or require a manual call to
deallocate a widget tree (wxPython).

Python knows when it's time to deallocate C resources, and then makes
a call to the tp_dealloc member of the type object.






More information about the Python-list mailing list