]> granicus.if.org Git - python/commitdiff
Fix some of the example code; the reference objects do not support a
authorFred Drake <fdrake@acm.org>
Fri, 3 Aug 2001 03:50:28 +0000 (03:50 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 3 Aug 2001 03:50:28 +0000 (03:50 +0000)
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.

Doc/lib/libweakref.tex

index 9062816d2d6ebff444d1c0e42035840e99859cc1..f5887b58fe77d9e057bdac3ab4a55dda61692ff7 100644 (file)
@@ -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}