Resolve circular reference

Carl Banks pavlovevidence at gmail.com
Fri Jan 7 10:56:26 EST 2011


On Jan 7, 3:58 am, moerchendiser2k3 <googler.
1.webmas... at spamgourmet.com> wrote:
> > Force what?
> > j refers to i, i refers to Foo, Foo refers to A. Therefore A should be
> > alive.
>
> Oh, sorry. Force the deletion of instance Foo(A) and Bar(B).

If you don't want j to keep i alive, you should look at weak
referencing.  (Look at the documentation for the weakref module.
Also, this has nothing to do with A and B being C-defined types; this
exact same behavior would happen even with Python types.)


Carl Banks



More information about the Python-list mailing list