From 0919a1a07b061ef9a8a94cc1d92c1895b00967cb Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 26 Aug 2006 20:49:04 +0000 Subject: Part of SF patch #1513870 (the still relevant part) -- add reduce() to functools, and adjust docs etc. --- Doc/howto/doanddont.tex | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'Doc/howto') diff --git a/Doc/howto/doanddont.tex b/Doc/howto/doanddont.tex index a105ca1fce..df3ca346a4 100644 --- a/Doc/howto/doanddont.tex +++ b/Doc/howto/doanddont.tex @@ -289,19 +289,7 @@ There are also many useful builtin functions people seem not to be aware of for some reason: \function{min()} and \function{max()} can find the minimum/maximum of any sequence with comparable semantics, for example, yet many people write their own -\function{max()}/\function{min()}. Another highly useful function is -\function{reduce()}. A classical use of \function{reduce()} -is something like - -\begin{verbatim} -import sys, operator -nums = map(float, sys.argv[1:]) -print reduce(operator.add, nums)/len(nums) -\end{verbatim} - -This cute little script prints the average of all numbers given on the -command line. The \function{reduce()} adds up all the numbers, and -the rest is just some pre- and postprocessing. +\function{max()}/\function{min()}. On the same note, note that \function{float()}, \function{int()} and \function{long()} all accept arguments of type string, and so are -- cgit v1.2.1