Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d54879

Browse files
committed
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.
1 parent f980301 commit 5d54879

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Doc/lib/libweakref.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ \subsection{Weak Reference Objects
151151
\end{verbatim}
152152

153153
Testing that a weak reference object is still live should be done
154-
using the expression \code{\var{ref}.get() is not None}. Normally,
154+
using the expression \code{\var{ref}() is not None}. Normally,
155155
application code that needs to use a reference object should follow
156156
this pattern:
157157

158158
\begin{verbatim}
159-
o = ref.get()
159+
o = ref()
160160
if o is None:
161161
# referent has been garbage collected
162162
print "Object has been allocated; can't frobnicate."
@@ -190,7 +190,7 @@ \subsection{Example \label{weakref-example}}
190190
_id2obj_dict[id(obj)] = obj
191191
192192
def id2obj(id):
193-
return _id2obj_dict.get(id)
193+
return _id2obj_dict(id)
194194
\end{verbatim}
195195

196196

0 commit comments

Comments
 (0)