weakref.WeakKeyDictionary.keyrefs()

WeakKeyDictionary.keyrefs() Return an iterable of the weak references to the keys.

weakref.WeakKeyDictionary

class weakref.WeakKeyDictionary([dict]) Mapping class that references keys weakly. Entries in the dictionary will be discarded when there is no longer a strong reference to the key. This can be used to associate additional data with an object owned by other parts of an application without adding attributes to those objects. This can be especially useful with objects that override attribute accesses. Note Caution: Because a WeakKeyDictionary is built on top of a Python dictionary, it must no

weakref.ReferenceType

weakref.ReferenceType The type object for weak references objects.

weakref.ReferenceError

exception weakref.ReferenceError Exception raised when a proxy object is used but the underlying object has been collected. This is the same as the standard ReferenceError exception.

weakref.ref.__callback__

__callback__ This read-only attribute returns the callback currently associated to the weakref. If there is no callback or if the referent of the weakref is no longer alive then this attribute will have value None.

weakref.ref

class weakref.ref(object[, callback]) Return a weak reference to object. The original object can be retrieved by calling the reference object if the referent is still alive; if the referent is no longer alive, calling the reference object will cause None to be returned. If callback is provided and not None, and the returned weakref object is still alive, the callback will be called when the object is about to be finalized; the weak reference object will be passed as the only parameter to the

weakref.ProxyTypes

weakref.ProxyTypes Sequence containing all the type objects for proxies. This can make it simpler to test if an object is a proxy without being dependent on naming both proxy types.

weakref.ProxyType

weakref.ProxyType The type object for proxies of objects which are not callable.

weakref.proxy()

weakref.proxy(object[, callback]) Return a proxy to object which uses a weak reference. This supports use of the proxy in most contexts instead of requiring the explicit dereferencing used with weak reference objects. The returned object will have a type of either ProxyType or CallableProxyType, depending on whether object is callable. Proxy objects are not hashable regardless of the referent; this avoids a number of problems related to their fundamentally mutable nature, and prevent their u

weakref.getweakrefs()

weakref.getweakrefs(object) Return a list of all weak reference and proxy objects which refer to object.