[Python-Dev] Rationale for sum()'s design?

Tim Peters tim.peters at gmail.com
Tue Mar 15 01:16:22 CET 2005

[Eric Nieuwland]
>> Perhaps the second argument should not be optional to emphasise this.
>> After all, there's much more to sum() than numbers.

[Greg Ewing]
> I think practicality beats purity here. Using it on
> numbers is surely an extremely common case.

I'd personally be delighted if sum() never worked on anything other
than numbers.  That makes it easy to understand, easy to document,
easy to remember, obvious at first sight, and straightforward to
implement.  Everything a framework isn't, but it's not a bad thing to
have *something* that actually means exactly what it looks like it
says <0.5 wink>.

More information about the Python-Dev mailing list