[Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.6,1.100.4.7
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Wed, 17 Jul 2002 06:55:48 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv23246/lib
Modified Files:
Tag: release22-maint
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.100.4.6
retrieving revision 1.100.4.7
diff -C2 -d -r1.100.4.6 -r1.100.4.7
*** libfuncs.tex 9 Jul 2002 05:27:12 -0000 1.100.4.6
--- libfuncs.tex 17 Jul 2002 13:55:46 -0000 1.100.4.7
***************
*** 678,687 ****
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}
--- 678,687 ----
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}