summaryrefslogtreecommitdiffstats
path: root/Doc/library/weakref.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/weakref.rst')
-rw-r--r--Doc/library/weakref.rst14
1 files changed, 12 insertions, 2 deletions
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index 1bf6b58..78ff21d0 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -111,6 +111,15 @@ Extension types can easily be made to support weak references; see
This is a subclassable type rather than a factory function.
+ .. attribute:: __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``.
+
+ .. versionadded:: 3.4
+ Added the :attr:`__callback__` attribute.
+
.. function:: proxy(object[, callback])
@@ -261,8 +270,9 @@ These method have the same issues as the and :meth:`keyrefs` method of
Weak Reference Objects
----------------------
-Weak reference objects have no attributes or methods, but do allow the referent
-to be obtained, if it still exists, by calling it:
+Weak reference objects have no methods and no attributes besides
+:attr:`ref.__callback__`. A weak reference object allows the referent to be
+obtained, if it still exists, by calling it:
>>> import weakref
>>> class Object: