Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
   ...
> I agree with Guido about the special case, but I disagree about the
> error message.  Not being able to use sum(L,"") reduces the
> orthogonality of sum for no good reason I could see.

Having sum(L,'') work but be O(N squared) would be an "attractive
nuisance" within the meaning of the law; it's bad enough that sum(L,[])
etc are that way, but at least beginners want to concatenate lists (or
tuples, arrays, etc) much less often than they want to concatenate
strings.  sum is meant to work on _numbers_ -- the reason it takes that
second optional parameter is essentially to be able to specify the
``type'' of numbers.  In retrospect it might have been better to have a
single argument (or interpret multiple ones like min or max do, maybe),
forcing the starting value to be integer 0.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to