On Sun, Apr 20, 2003 at 01:18:08AM -0700, Brett Cannon wrote: > [Alex Martelli] > > > On Sunday 20 April 2003 08:09 am, Prabhu Ramachandran wrote: > <snip> ... > > In the context of Numeric use, it's quite appropriate to have sum, > prod, > > and the other ufuncs' reduce AND accumulate methods. In everyday > > programming in other fields, the demand for the functionality given by > > sum is FAR higher than that given by prod. > <snip> > > I think part of the trouble here is the name. The word "sum" just > automatically causes one to think math. This leads to thinking of > multiplication, division, and subtraction. But Alex's proposed function > does more than a summation by special-casing the concatentation of > strings. The special case is just a performance optimization. Without it the sum function would still return the same result. The sum function should work for any object that defines a + operator. I agree that the name 'sum' isn't 100% intuitive for use with strings but I can't think of any name that would be really natural for both. Oren
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4