Lines Matching refs:weakref
1 :mod:`weakref` --- Weak references
4 .. module:: weakref
12 **Source code:** :source:`Lib/weakref.py`
16 The :mod:`weakref` module allows the Python programmer to create :dfn:`weak
40 the :mod:`weakref` module are an alternative, using weak references to construct
64 exposed by the :mod:`weakref` module for the benefit of advanced uses.
88 :ref:`weakref-support`.
97 weakref object is still alive, the callback will be called when the object is
124 weakref. If there is no callback or if the referent of the weakref is
224 >>> r = weakref.ref(c.method)
226 >>> r = weakref.WeakMethod(c.method)
347 >>> import weakref
352 >>> r = weakref.ref(o)
392 import weakref
394 class ExtendedRef(weakref.ref):
426 import weakref
428 _id2obj_dict = weakref.WeakValueDictionary()
448 >>> import weakref
453 >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS
466 >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
479 >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
493 >>> weakref.finalize(obj, print, "obj dead or exiting") #doctest:+ELLIPSIS
545 self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)
558 The other advantage of weakref based finalizers is that they can be used to
562 import weakref, sys
565 weakref.finalize(sys.modules[__name__], unloading_module)