Vedran Čačić <ved...@gmail.com> added the comment:

The fact that you've forgotten about it is exactly why sum tries to educate you 
(despite Python being "the language of consenting adults" in most other 
aspects). The problem (why it doesn't do a good job in that aspect) is that 
people usually expect sum to act like a 2-arg form of functools.reduce, while 
in fact it acts like a 3-arg form, with 0 as the initializer.

I doubt that Python will change regarding that, but you can sharpen your 
intuition by asking yourself: what do you expect sum([]) to be? If 0, then 
you're inconsistent. :-)

----------
nosy: +veky

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41740>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to