[Python-ideas] Why does `sum` use a default for the `start` parameter?
george.sakkis at gmail.com
Sat Dec 5 20:07:22 CET 2009
On Sat, Dec 5, 2009 at 8:39 PM, Vitor Bosshard <algorias at gmail.com> wrote:
> 2009/12/5 George Sakkis <george.sakkis at gmail.com>:
>> Agreed that there is little harm in preferring numbers over other
>> types when it comes to empty sequences, but the more important
>> question is "should the start argument be used even if the sequence is
>> *not* empty?". The OP doesn't think so and I agree.
> In that case, "default" would be a more appropriate name than "start".
> That change of concept is a potential break in compatibility. How
> often is the start argument given as a non-zero value? Not all that
> often I suppose, but it's still a valid use-case. Ergo, the start
> argument should never be omitted if it was explicitly set.
Ok I see the different semantics between 'start' and 'default' and the
use cases for each but at the end of the day there should be a way
(preferably the default) that given a sequence [x1, ..., xN] one can
compute "x1+...+xN" instead of "start+x1+...+xN".
More information about the Python-ideas