[Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.111,1.112
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Wed, 17 Jul 2002 06:55:35 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv23103/lib
Modified Files:
libfuncs.tex
Log Message:
reduce(): Clarified what is returned in the case of a sequence 1 item long and
initial/default value.
Index: libfuncs.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -d -r1.111 -r1.112
*** libfuncs.tex 9 Jul 2002 05:25:46 -0000 1.111
--- libfuncs.tex 17 Jul 2002 13:55:33 -0000 1.112
***************
*** 718,727 ****
Apply \var{function} of two arguments cumulatively to the items of
\var{sequence}, from left to right, so as to reduce the sequence to
! a single value. For example,
! \code{reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])} calculates
! \code{((((1+2)+3)+4)+5)}.
! If the optional \var{initializer} is present, it is placed before
! the items of the sequence in the calculation, and serves as a
! default when the sequence is empty.
\end{funcdesc}
--- 718,727 ----
Apply \var{function} of two arguments cumulatively to the items of
\var{sequence}, from left to right, so as to reduce the sequence to
! a single value. For example, \code{reduce(lambda x, y: x+y, [1, 2,
! 3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}. If the optional
! \var{initializer} is present, it is placed before the items of the
! sequence in the calculation, and serves as a default when the
! sequence is empty. If \var{initializer} is not given and
! \var{sequence} contains only one item, the first item is returned.
\end{funcdesc}