Circular references (was: Defining VCL-like framework for Py

Greg Ewing greg.ewing at compaq.com
Tue Jun 1 06:11:11 CEST 1999


Gordon McMillan wrote:
> 
> Ce'Nedra, er, Hans wrote:
> 
> Another way is to put one of them (the parent, normally) in some
> kind of collection, (say, a dict keyed by a name, like id(parent)).
> Tell the child the parent's name and the collection. When you cut the
> parent loose from the dict, it goes away (the child does not directly
> reference it). Then the child goes away (nobody is referencing it).

I don't see how this helps, because then you have to do something
special to make the parent go away (the dict is holding a reference
to it). If you know when the parent is supposed to go away, you
might as well call parent.free().

Greg




More information about the Python-list mailing list