Parent references: hot or not?

darrell dgallion1 at yahoo.com
Sat Apr 19 21:43:07 CEST 2003


Check the weakref module.
The child can keep a weakref to the parent. This won't set up a cycle.

--Darrell


Dylan Reinhardt wrote:

> Hi all,
> 
> I'm working on a project where I have multiple instances of a container
> class that each hold a large number of another class.
> 
> I need the "contained" object to be able to make use of methods and
> attributes in its container. Inheritance won't do the trick since the
> things I need to refer to will be pretty dynamic.
> 
> A very minimal example of what I'm doing:
> 





More information about the Python-list mailing list