[Python-ideas] Why does `sum` use a default for the `start` parameter?
Andre Engels
andreengels at gmail.com
Sat Dec 5 17:45:33 CET 2009
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.
--
André Engels, andreengels at gmail.com
More information about the Python-ideas
mailing list