[Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.60,1.61

Barry Warsaw bwarsaw@users.sourceforge.net
2001年6月26日 13:33:01 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6442
Modified Files:
	libstdtypes.tex 
Log Message:
Remove the restriction on a mapping's .update() method.
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -r1.60 -r1.61
*** libstdtypes.tex	2001年06月12日 03:31:56	1.60
--- libstdtypes.tex	2001年06月26日 20:32:59	1.61
***************
*** 934,950 ****
 \lineiii{\var{a}.update(\var{b})}
 {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}}
! {(4)}
 \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)}
 \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})}
 {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
 else \var{x}}
! {(5)}
 \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})}
 {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
 else \var{x} (also setting it)}
! {(6)}
 \lineiii{\var{a}.popitem()}
 {remove and return an arbitrary (\var{key}, \var{value}) pair}
! {(7)}
 \lineiii{\var{a}.iteritems()}
 {return an iterator over (\var{key}, \var{value}) pairs}
--- 934,950 ----
 \lineiii{\var{a}.update(\var{b})}
 {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}}
! {}
 \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)}
 \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})}
 {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
 else \var{x}}
! {(4)}
 \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})}
 {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
 else \var{x} (also setting it)}
! {(5)}
 \lineiii{\var{a}.popitem()}
 {remove and return an arbitrary (\var{key}, \var{value}) pair}
! {(6)}
 \lineiii{\var{a}.iteritems()}
 {return an iterator over (\var{key}, \var{value}) pairs}
***************
*** 972,987 ****
 \var{key})} pairs using \function{zip()}: \samp{pairs =
 zip(\var{a}.values(), \var{a}.keys())}.
- 
- \item[(4)] \var{b} must be of the same type as \var{a}.
 
! \item[(5)] Never raises an exception if \var{k} is not in the map,
 instead it returns \var{x}. \var{x} is optional; when \var{x} is not
 provided and \var{k} is not in the map, \code{None} is returned.
 
! \item[(6)] \function{setdefault()} is like \function{get()}, except
 that if \var{k} is missing, \var{x} is both returned and inserted into
 the dictionary as the value of \var{k}.
 
! \item[(7)] \function{popitem()} is useful to destructively iterate
 over a dictionary, as often used in set algorithms.
 \end{description}
--- 972,985 ----
 \var{key})} pairs using \function{zip()}: \samp{pairs =
 zip(\var{a}.values(), \var{a}.keys())}.
 
! \item[(4)] Never raises an exception if \var{k} is not in the map,
 instead it returns \var{x}. \var{x} is optional; when \var{x} is not
 provided and \var{k} is not in the map, \code{None} is returned.
 
! \item[(5)] \function{setdefault()} is like \function{get()}, except
 that if \var{k} is missing, \var{x} is both returned and inserted into
 the dictionary as the value of \var{k}.
 
! \item[(6)] \function{popitem()} is useful to destructively iterate
 over a dictionary, as often used in set algorithms.
 \end{description}

AltStyle によって変換されたページ (->オリジナル) /