Skip to content
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

Allow start parameter in Python's sum #34007

Closed
bgrenet opened this issue Jun 17, 2022 · 6 comments
Closed

Allow start parameter in Python's sum #34007

bgrenet opened this issue Jun 17, 2022 · 6 comments

Comments

@bgrenet
Copy link
Contributor

bgrenet commented Jun 17, 2022

From Python 3.8, the start parameter of the built-in function sum can be given as a keyword argument. For instance:

>>> sum([1,2,3], start=1)
7
>>> sum([[1],[2]], start=[])
[1, 2]

Sage's symbolic_sum, imported as sum and overwriting the original sum, does not pass this keyword argument. Hence in Sage:

>>> sum([1,2,3], start=1)
6
>>> sum([[1],[2]], start=[])
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for +: 'int' and 'list'

Component: misc

Keywords: sum

Author: Bruno Grenet

Branch/Commit: e2ae675

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/34007

@bgrenet bgrenet added this to the sage-9.7 milestone Jun 17, 2022
@bgrenet
Copy link
Contributor Author

bgrenet commented Jun 17, 2022

Author: Bruno Grenet

@bgrenet
Copy link
Contributor Author

bgrenet commented Jun 17, 2022

New commits:

e2ae675Pass the start keyword parameter

@bgrenet
Copy link
Contributor Author

bgrenet commented Jun 17, 2022

Commit: e2ae675

@bgrenet
Copy link
Contributor Author

bgrenet commented Jun 17, 2022

Branch: u/bruno/sum_with_start_keyword

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 17, 2022

Reviewer: Matthias Koeppe

@vbraun
Copy link
Member

vbraun commented Jun 28, 2022

Changed branch from u/bruno/sum_with_start_keyword to e2ae675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants