python/dist/src/Doc/lib libweakref.tex, 1.27.4.1, 1.27.4.2
Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4899/Doc/lib Modified Files: Tag: release24-maint libweakref.tex Log Message: backport doctest for weakref examples Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.27.4.1 retrieving revision 1.27.4.2 diff -u -d -r1.27.4.1 -r1.27.4.2 --- libweakref.tex 2 Jul 2005 10:44:38 -0000 1.27.4.1 +++ libweakref.tex 2 Jul 2005 19:09:42 -0000 1.27.4.2 @@ -10,6 +10,8 @@ \versionadded{2.1} +% When making changes to the examples in this file, be sure to update +% Lib/test/test_weakref.py::libreftest too! The \module{weakref} module allows the Python programmer to create \dfn{weak references} to objects. @@ -228,7 +230,7 @@ o = r() if o is None: # referent has been garbage collected - print "Object has been allocated; can't frobnicate." + print "Object has been deallocated; can't frobnicate." else: print "Object is still live!" o.do_something_useful() @@ -265,7 +267,7 @@ """Return a pair containing the referent and the number of times the reference has been called. """ - ob = super(ExtendedRef, self)() + ob = super(ExtendedRef, self).__call__() if ob is not None: self.__counter += 1 ob = (ob, self.__counter)
participants (1)
-
birkenfeldīŧ users.sourceforge.net