[Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.5,1.6
Fred L. Drake
fdrake@users.sourceforge.net
2001年4月10日 12:58:00 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv16899/lib
Modified Files:
libweakref.tex
Log Message:
Remove the mapping() function from the documentation.
Add a description of the ReferenceError exception.
Index: libweakref.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** libweakref.tex 2001年03月28日 21:15:41 1.5
--- libweakref.tex 2001年04月10日 19:57:58 1.6
***************
*** 53,74 ****
\end{funcdesc}
- \begin{funcdesc}{mapping}{\optional{dict\optional{, weakkeys=0}}}
- Return a weak dictionary. If \var{dict} is given and not
- \code{None}, the new dictionary will contain the items contained in
- \var{dict}. The values from \var{dict} must be weakly referencable;
- if any values which would be inserted into the new mapping are not
- weakly referencable, \exception{TypeError} will be raised and the
- new mapping will be empty.
-
- If the \var{weakkeys} argument is not given or zero, the values in
- the dictionary are weak. That means the entries in the dictionary
- will be discarded when no strong reference to the value exists
- anymore.
-
- If the \var{weakkeys} argument is nonzero, the keys in the
- dictionary are weak, i.e. the entry in the dictionary is discarded
- when the last strong reference to the key is discarded.
- \end{funcdesc}
-
\begin{funcdesc}{proxy}{object\optional{, callback}}
Return a proxy to \var{object} which uses a weak reference. This
--- 53,56 ----
***************
*** 95,107 ****
\begin{classdesc}{WeakKeyDictionary}{\optional{dict}}
! The class of the mapping objects returned by \function{mapping()}
! when \var{weakkeys} is true. This can be used for subclassing the
! implementation if needed.
\end{classdesc}
\begin{classdesc}{WeakValueDictionary}{\optional{dict}}
! The class of the mapping objects returned by \function{mapping()}
! when \var{weakkeys} if false. This can be used for subclassing the
! implementation if needed.
\end{classdesc}
--- 77,92 ----
\begin{classdesc}{WeakKeyDictionary}{\optional{dict}}
! Mapping class that references keys weakly. Entries in the
! dictionary will be discarded when there is no longer a strong
! reference to the key. This can be used to associate additional data
! with an object owned by other parts of an application without adding
! attributes to those objects. This can be especially useful with
! objects that override attribute accesses.
\end{classdesc}
\begin{classdesc}{WeakValueDictionary}{\optional{dict}}
! Mapping class that references values weakly. Entries in the
! dictionary will be discarded when no strong reference to the value
! exists anymore.
\end{classdesc}
***************
*** 124,127 ****
--- 109,117 ----
\end{datadesc}
+ \begin{excdesc}{ReferenceError}
+ Exception raised when a proxy object is used but the underlying
+ object has been collected.
+ \end{excdesc}
+
\begin{seealso}
***************
*** 194,198 ****
import weakref
! _id2obj_dict = weakref.mapping()
def remember(obj):
--- 184,188 ----
import weakref
! _id2obj_dict = weakref.WeakValueDictionary()
def remember(obj):