[Python-Dev] Patch for Weak References for Functions

Phil Thompson phil@river-bank.demon.co.uk
Sat, 10 Mar 2001 11:06:07 +0000


Skip Montanaro wrote:
> 
>     Phil> This is a design decision - earlier versions did do this but it
>     Phil> almost always results in circular reference counts.
> 
> With cyclic GC couldn't you just let those circular reference counts occur
> and rely on the GC machinery to break the cycles?  Or do you have __del__
> methods?

Remember I'm ignorant when it comes to cyclic GC - PyQt is older and I
didn't pay much attention to it when it was introduced, so I may be
missing a trick. One thing though, if you have a dialog display and have
a circular reference to it, then you del() the dialog instance - when
will the GC actually get around to resolving the circular reference and
removing the dialog from the screen? It must be guaranteed to do so
before the Qt event loop is re-entered.

Every PyQt class has a __del__ method (because I need to control the
order in which instance "variables" are deleted).

Phil