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.
89 :ref:`weakref-support`.
98 weakref object is still alive, the callback will be called when the object is
125 weakref. If there is no callback or if the referent of the weakref is
219 >>> r = weakref.ref(c.method)
221 >>> r = weakref.WeakMethod(c.method)
336 >>> import weakref
341 >>> r = weakref.ref(o)
381 import weakref
383 class ExtendedRef(weakref.ref):
415 import weakref
417 _id2obj_dict = weakref.WeakValueDictionary()
437 >>> import weakref
442 >>> weakref.finalize(kenny, print, "You killed Kenny!") #doctest:+ELLIPSIS
455 >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
468 >>> f = weakref.finalize(obj, callback, 1, 2, z=3)
485 >>> weakref.finalize(obj, print, "obj dead or exiting")
537 self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)
550 The other advantage of weakref based finalizers is that they can be used to
554 import weakref, sys
557 weakref.finalize(sys.modules[__name__], unloading_module)