New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nit for builtin sum doc #42348
Comments
the docstring signature for sum in bltinmodule.c (or else the implementation should be changed |
Logged In: YES While the proposed change is technically correct, I find the |
Logged In: YES This is relatively minor so I don't mean >>> sum([x] for x in xrange(10))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for +: 'int' and 'list'
>>> help(sum)
Help on built-in function sum in module __builtin__: sum(...)
sum(sequence, start=0) -> value
Returns the sum of a sequence of numbers (NOT strings) plus the value
of parameter 'start'. When the sequence is empty, returns start. >>> sum([x] for x in xrange(10), start=[])
File "<stdin>", line 1
SyntaxError: invalid syntax # The problem above is orthogonal to the issue in this bug, >>> sum(([x] for x in xrange(10)), start=[])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: sum() takes no keyword arguments # examine lib docs, which give the signature: >>> sum(([x] for x in xrange(10)), [])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> # examine bltinmodule.c to confirm that |
1 similar comment
Logged In: YES This is relatively minor so I don't mean >>> sum([x] for x in xrange(10))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for +: 'int' and 'list'
>>> help(sum)
Help on built-in function sum in module __builtin__: sum(...)
sum(sequence, start=0) -> value
Returns the sum of a sequence of numbers (NOT strings) plus the value
of parameter 'start'. When the sequence is empty, returns start. >>> sum([x] for x in xrange(10), start=[])
File "<stdin>", line 1
SyntaxError: invalid syntax # The problem above is orthogonal to the issue in this bug, >>> sum(([x] for x in xrange(10)), start=[])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: sum() takes no keyword arguments # examine lib docs, which give the signature: >>> sum(([x] for x in xrange(10)), [])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> # examine bltinmodule.c to confirm that |
Logged In: YES """
>>> sum([x] for x in xrange(10), start=[])
File "<stdin>", line 1
SyntaxError: invalid syntax # The problem above is orthogonal to the issue in this bug, FYI, the answer is no. The requirement for parenthesis |
Logged In: YES If we change the function signature in the docstring, we |
Logged In: YES Fixed in rev. 52315. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: