Open
Description
Bug report
Bug description:
The doc of itertools.accumulate()
says the 2nd parameter is function
as shown below:
itertools.accumulate(iterable[, function, *, initial=None])
But using function
argument gets the error against the doc as shown below:
from itertools import accumulate
from operator import mul
# ↓↓↓↓↓↓↓↓
for x in accumulate(iterable=[1, 2, 3, 4, 5], function=mul):
print(x)
# TypeError: 'function' is an invalid keyword argument for accumulate()
So, I used func
argument, then it works as shown below:
from itertools import accumulate
from operator import mul
# ↓↓↓↓
for x in accumulate(iterable=[1, 2, 3, 4, 5], func=mul):
print(x)
# 1
# 2
# 6
# 24
# 120
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Todo