Weak Lists?
Michael Chermside
mcherm at destiny.com
Wed Jan 16 10:32:04 EST 2002
I would like a weak list -- a list in which the values are held with
weak links. I can write one myself -- particularly if I only support the
methods I care about (append(), __getitem__(), __iter__(), and sort()),
but it seems like someone else has probably written (and tested!) this
already... right?
For those who might be interested, I want this because I am creating a
tree, with something sort of like this:
def TreeNode:
def __init__( self, parent ):
self.parent = parent
parent.childNodes.append( self )
self.childNodes = []
... and I thought it would be nice to let the structure clean up without
having to invoke the circular reference garbage collector.
-- Michael Chermside
More information about the Python-list
mailing list