This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vsinitsyn
Recipients docs@python, vsinitsyn
Date 2015-03-27.11:24:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427455446.97.0.658394608092.issue23787@psf.upfronthosting.co.za>
In-reply-to
Content
sum() function doctstring describes expected arguments as follows (Python 2.7.6):

sum(...)
    sum(sequence[, start]) -> value
...

This implies sum() should accept str, unicode, list, tuple, bytearray, buffer, and xrange. However, you clearly can't use this function to sum strings (which is also mentioned in the docstring):

>>> sum('abc')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

I'd suggest to describe first argument as iterable, which is actually what sum() expects there.
History
Date User Action Args
2015-03-27 11:24:07vsinitsynsetrecipients: + vsinitsyn, docs@python
2015-03-27 11:24:06vsinitsynsetmessageid: <1427455446.97.0.658394608092.issue23787@psf.upfronthosting.co.za>
2015-03-27 11:24:06vsinitsynlinkissue23787 messages
2015-03-27 11:24:06vsinitsyncreate