[docs] [issue18424] sum() does not return only the sum of a sequence of numbers + PEP8 reccomandation
report at bugs.python.org
Wed Jul 10 17:13:37 CEST 2013
Ezio Melotti added the comment:
Currently sum() is intended to work with numbers, explicitly forbids strings (as noted in the docstring), but also works with other types (even though it's inefficient).
If we want to document this, a possible wording might be:
Returns the sum of a sequence of numbers plus the
value of parameter 'start' (which defaults to 0).
When the sequence is empty, returns start.
Using sum() with a sequence of strings is not allowed,
and might be inefficient with sequences of other types.
We should also consider that the implementation/behavior might change in future, but we can always update the docstring again.
+1 on the PEP 8 changes.
Python tracker <report at bugs.python.org>
More information about the docs