Python Weakref Module
Weak references — ref, proxy, WeakValueDictionary, WeakSet. This category documents 6 Python weakref module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: weakref.ref(), weakref.proxy(), weakref.WeakValueDictionary(), weakref.WeakKeyDictionary(), weakref.WeakSet(), weakref.finalize(). weakref.ref() creates a weak reference object. Call .deref() to get the object or None if collected. weakref.proxy() creates a weak reference proxy that acts like the original object. weakref.WeakValueDictionary() a dictionary that holds weak references to its values. weakref.WeakKeyDictionary() a dictionary that holds weak references to its keys. weakref.WeakSet() a set that holds weak references to its elements. Weakref Module belongs to the Collections & Iteration group alongside Collections Module, Itertools Module, Functools Module, Operator Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.