That is like Lisp's +, must be good :P

Michael


On Sun, 13 Mar 2005 08:38:42 -0800, Guido van Rossum
<[EMAIL PROTECTED]> wrote:
> There are a few design choices we could have made for sum(); in
> particular, for non-empty sequences we could not have used the
> identity element (the optional second argument). As it is, we get
> unjustified but understandable complaints that sum() "only supports
> numbers". An alternative design could have returned:
> 
> - the identity (defaulting to 0) if the sequence is empty
> - the first and only element if the sequence only has one element
> - (...(((A + B) + C) + D) + ...) if the sequence has more than one element
> 
> This has surprises too (in particular of returning 0 when invoked
> without overriding the identity argument for a seqence of addable
> non-numbers) but works without using the second argument for a larger
> set of inputs I believe it is often used in such a way that the input
> is known to be non-empty).
> 
> I'd be happy to be pointed to a past discussion where this was
> considered and rejected with a good reason; then I can post that to
> the blog (where the deficiency in sum() is being berated a bit
> excessively).
> 
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/michael.walter%40gmail.com
>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to