-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Open
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Todo