WeakValueDictionary
Bryan
belred1 at yahoo.com
Sat Oct 2 23:49:09 EDT 2004
there must be something i don't understand about WeakKeyDictionary and WeakValueDictionary. i had expected the last
line to be empty because i thought i deleted the last strong reference to variable "a". what am i misunderstanding?
>>> d = weakref.WeakValueDictionary()
>>> a = A()
>>> d[1] = a
>>> d.items()
[(1, <__main__.A instance at 0x0116BC60>)]
>>> del a
>>> d.items()
[(1, <__main__.A instance at 0x0116BC60>)]
>>>
thanks,
bryan
More information about the Python-list
mailing list