diff options
author | Fred Drake <fdrake@acm.org> | 2001-08-03 03:50:28 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-08-03 03:50:28 (GMT) |
commit | 5d548796474d63db729903cd67a21e0a9f1e6666 (patch) | |
tree | 13d71434b5ca0103048000a128f5c2a38aa5db11 /Doc/lib/libweakref.tex | |
parent | f980301b09a7cf66a4e370f61e1baa2ee2f1f38e (diff) | |
download | cpython-5d548796474d63db729903cd67a21e0a9f1e6666.zip cpython-5d548796474d63db729903cd67a21e0a9f1e6666.tar.gz cpython-5d548796474d63db729903cd67a21e0a9f1e6666.tar.bz2 |
Fix some of the example code; the reference objects do not support a
get() method; just calling them is sufficient. (There was a get() method
for this in an early version of the implementation.)
Reported by Mats Wichmann.
Diffstat (limited to 'Doc/lib/libweakref.tex')
-rw-r--r-- | Doc/lib/libweakref.tex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/lib/libweakref.tex b/Doc/lib/libweakref.tex index 9062816..f5887b5 100644 --- a/Doc/lib/libweakref.tex +++ b/Doc/lib/libweakref.tex @@ -151,12 +151,12 @@ None \end{verbatim} Testing that a weak reference object is still live should be done -using the expression \code{\var{ref}.get() is not None}. Normally, +using the expression \code{\var{ref}() is not None}. Normally, application code that needs to use a reference object should follow this pattern: \begin{verbatim} -o = ref.get() +o = ref() if o is None: # referent has been garbage collected print "Object has been allocated; can't frobnicate." @@ -190,7 +190,7 @@ def remember(obj): _id2obj_dict[id(obj)] = obj def id2obj(id): - return _id2obj_dict.get(id) + return _id2obj_dict(id) \end{verbatim} |