[Python-Dev] Fwd: summing a bunch of numbers (or "whatevers")
Mon, 21 Apr 2003 22:26:07 -0400
On 20 April 2003, Guido van Rossum said:
> I'm not too worried that people will ask for prod() as well. And if
> they do, maybe we can give them that too; there's not much else along
> the same lines (bitwise or/and; ha ha ha) so even if the slope may be
> a bit slippery, I'm not worried about sliding too far.
I can't count the number of times sum() would have been useful to me. I
can count the number of times prod() would have been: zero.
Bitwise and/or en masse seems unnecessary (although I remember being
quite tickled by the fact that you can do bitwise operations on strings
in Perl -- whee, fun! -- when I was young and naive).
However, there have been a number of occasions where I wanted *logical*
and/or en masse: are any/all elements of this list true/false? On
several occasions I tried to do it in one super-clever line of code
using reduce(), and I think I even succeeded once. But usually I give
up and make it a loop. IMHO *this* is likely to be the feature people
start asking for after they decide sum() is handy.
PS. my nominations for removal in Python 3.0: reduce() and filter().
Greg Ward <email@example.com> http://www.gerg.ca/
What happens if you touch these two wires tog--