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

Fred L. Drake fdrake@users.sourceforge.net
2001年5月24日 21:24:39 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv1010/lib
Modified Files:
	libstdtypes.tex 
Log Message:
Add descriptions of {}.iteritems(), {}.iterkeys(), and {}.itervalues()
in the table of mapping object operations. Re-numbered the list of
notes to reflect the move of the "Added in version 2.2." note to the list
of notes instead of being inserted into the last column of the table.
Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -r1.58 -r1.59
*** libstdtypes.tex	2001年05月03日 04:39:10	1.58
--- libstdtypes.tex	2001年05月25日 04:24:37	1.59
***************
*** 924,950 ****
 \lineiii{\var{k} \code{in} \var{a}}
 {Equivalent to \var{a}.has_key(\var{k})}
! {\versionadded{2.2}}
 \lineiii{\var{k} not in \var{a}}
 {Equivalent to \code{not} \var{a}.has_key(\var{k})}
! {\versionadded{2.2}}
 \lineiii{\var{a}.items()}
 {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs}
! {(2)}
 \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
 \lineiii{\var{a}.update(\var{b})}
 {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}}
! {(3)}
 \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)}
 \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)}
 \end{tableiii}
 
--- 924,959 ----
 \lineiii{\var{k} \code{in} \var{a}}
 {Equivalent to \var{a}.has_key(\var{k})}
! {(2)}
 \lineiii{\var{k} not in \var{a}}
 {Equivalent to \code{not} \var{a}.has_key(\var{k})}
! {(2)}
 \lineiii{\var{a}.items()}
 {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs}
! {(3)}
 \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)}
 \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}{(2)}
 \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}
! {(2)}
! \lineiii{\var{a}.iterkeys()}
! {return an iterator over the mapping's keys}
! {(2)}
! \lineiii{\var{a}.itervalues()}
! {return an iterator over the mapping's values}
! {(2)}
 \end{tableiii}
 
***************
*** 954,959 ****
 \item[(1)] Raises a \exception{KeyError} exception if \var{k} is not
 in the map.
 
! \item[(2)] Keys and values are listed in random order. If
 \method{keys()} and \method{values()} are called with no intervening
 modifications to the dictionary, the two lists will directly
--- 963,970 ----
 \item[(1)] Raises a \exception{KeyError} exception if \var{k} is not
 in the map.
+ 
+ \item[(2)] \versionadded{2.2}
 
! \item[(3)] Keys and values are listed in random order. If
 \method{keys()} and \method{values()} are called with no intervening
 modifications to the dictionary, the two lists will directly
***************
*** 962,976 ****
 \var{a}.values(), \var{a}.keys())}.
 
! \item[(3)] \var{b} must be of the same type as \var{a}.
 
! \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}
--- 973,987 ----
 \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}

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