[Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.104,1.105

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 19 Aug 2002 14:59:00 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv7981

Modified Files:
	libstdtypes.tex 
Log Message:
Extend some comments on the order of values in the returns from
dict.items/keys/values/iteritems/iterkeys/itervalues().


Index: libstdtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** libstdtypes.tex	7 Aug 2002 15:40:15 -0000	1.104
--- libstdtypes.tex	19 Aug 2002 21:58:58 -0000	1.105
***************
*** 1050,1060 ****
    \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}
  
--- 1050,1060 ----
    \lineiii{\var{a}.iteritems()}
            {return an iterator over (\var{key}, \var{value}) pairs}
!           {(2), (3)}
    \lineiii{\var{a}.iterkeys()}
            {return an iterator over the mapping's keys}
!           {(2), (3)}
    \lineiii{\var{a}.itervalues()}
            {return an iterator over the mapping's values}
!           {(2), (3)}
  \end{tableiii}
  
***************
*** 1068,1076 ****
  
  \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
! correspond.  This allows the creation of \code{(\var{value},
! \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,
--- 1068,1082 ----
  
  \item[(3)] Keys and values are listed in random order.  If
! \method{items()}, \method{keys()}, \method{values()},
! \method{iteritems()}, \method{iterkeys()}, and \method{itervalues()}
! are called with no intervening modifications to the dictionary, the
! lists will directly correspond.  This allows the creation of
! \code{(\var{value}, \var{key})} pairs using \function{zip()}:
! \samp{pairs = zip(\var{a}.values(), \var{a}.keys())}.  The same
! relationship holds for the \method{iterkeys()} and
! \method{itervalues()} methods: \samp{pairs = zip(\var{a}.itervalues(),
! \var{a}.iterkeys())} provides the same value for \code{pairs}.
! Another way to create the same list is \samp{pairs = [(v, k) for (k,
! v) in \var{a}.iteritems()]}.
  
  \item[(4)] Never raises an exception if \var{k} is not in the map,