weakref.WeakValueDictionary

class weakref.WeakValueDictionary([dict])

Mapping class that references values weakly. Entries in the dictionary will be discarded when no strong reference to the value exists any more.

Note

Caution: Because a WeakValueDictionary is built on top of a Python dictionary, it must not change size when iterating over it. This can be difficult to ensure for a WeakValueDictionary because actions performed by the program during iteration may cause items in the dictionary to vanish “by magic” (as a side effect of garbage collection).

doc_python
2016-10-07 17:47:20
Comments
Leave a Comment

Please login to continue.