[Python-ideas] Why does `sum` use a default for the `start` parameter?

Vitor Bosshard algorias at gmail.com
Sat Dec 5 19:39:39 CET 2009


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.



More information about the Python-ideas mailing list