sum for sequences?

Neil Cerutti neilc at
Thu Mar 25 13:37:14 CET 2010

On 2010-03-25, Steven D'Aprano <steven at> wrote:
>> You might not want to be so glib.  The sum doc sure doesn't
>> sound like it should work on lists.
>>     Returns the sum of a sequence of numbers (NOT strings) plus the
>>     value of parameter 'start' (which defaults to 0).
> What part of that suggested to you that sum might not be polymorphic? 
> Sure, it says numbers (which should be changed, in my opinion), but it 
> doesn't specify what sort of numbers -- ints, floats, or custom types 
> that have an __add__ method.


Neil Cerutti
"It's not fun to build walls. But it's even less fun to live
without walls in a world full of zombies." --Greedy Goblin

More information about the Python-list mailing list