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

George Sakkis george.sakkis at gmail.com
Sat Dec 5 18:01:01 CET 2009

On Sat, Dec 5, 2009 at 6:45 PM, Andre Engels <andreengels at gmail.com> wrote:

> On Sat, Dec 5, 2009 at 12:55 PM, Ram Rachum <cool-rr at cool-rr.com> wrote:
>> I noticed that `sum` tries to add zero to your iterable. Why? Why not just skip
>> adding any start value if none is specified?
>> This current behavior is preventing me from using `sum` to add up a bunch of non-
>> number objects.
> In your proposed implementation, sum([]) would be undefined.

Which would make it consistent with min/max.


More information about the Python-ideas mailing list