diff options
author | Raymond Hettinger <python@rcn.com> | 2004-05-31 03:09:25 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-05-31 03:09:25 (GMT) |
commit | 027bb633b6899a0847d81cb35cbccdff5a468766 (patch) | |
tree | 4d6694b894394f6dd73ed6eb7c8c47c1909f056d /Doc | |
parent | cb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa (diff) | |
download | cpython-027bb633b6899a0847d81cb35cbccdff5a468766.zip cpython-027bb633b6899a0847d81cb35cbccdff5a468766.tar.gz cpython-027bb633b6899a0847d81cb35cbccdff5a468766.tar.bz2 |
Add weakref support to sockets and re pattern objects.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libweakref.tex | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Doc/lib/libweakref.tex b/Doc/lib/libweakref.tex index c8d82a8..f2ba80b 100644 --- a/Doc/lib/libweakref.tex +++ b/Doc/lib/libweakref.tex @@ -48,9 +48,23 @@ by the \module{weakref} module for the benefit of advanced uses. Not all objects can be weakly referenced; those objects which can include class instances, functions written in Python (but not in C), -and methods (both bound and unbound). Extension types can easily -be made to support weak references; see section \ref{weakref-extension}, -``Weak References in Extension Types,'' for more information. +methods (both bound and unbound), sets, frozensets, file objects, +sockets, arrays, deques, and regular expression pattern objects. +\versionchanged[Added support for files, sockets, arrays, and patterns]{2.4} + +Several builtin types such as \class{list} and \class{dict} do not +directly support weak references but can add support through subclassing: + +\begin{verbatim} +class Dict(dict): + pass + +obj = Dict(red=1, green=2, blue=3) # this object is weak referencable +\end{verbatim} + +Extension types can easily be made to support weak references; see section +\ref{weakref-extension}, ``Weak References in Extension Types,'' for more +information. \begin{funcdesc}{ref}{object\optional{, callback}} |