circular reference: canonical CPython approach please!

Warren Postma embed at geocities.com
Thu May 4 10:28:44 EDT 2000


Has anyone written something like this:


x = MyRedClassInstance();
y = MyBlueClassInstance();

x.y = shadow(y) # weak reference
y.x = shadow(x) # weak reference

When you del x, then y.x automatically becomes None, but otherwise, any
other problems are avoided.  Is that possible?

Warren







More information about the Python-list mailing list