sum for sequences?

Stefan Behnel stefan_ml at behnel.de
Thu Mar 25 08:44:35 EDT 2010


Neil Cerutti, 25.03.2010 13:37:
> On 2010-03-25, Steven D'Aprano 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.
>
> WTF.

Warning: truth found!

Stefan




More information about the Python-list mailing list