New submission from Valentine Sinitsyn:

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.

----------
assignee: docs@python
components: Documentation
messages: 239388
nosy: docs@python, vsinitsyn
priority: normal
severity: normal
status: open
title: sum() function docstring lists arguments incorrectly
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23787>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to