python / python/cpython

Using the `function` argument of `itertools.accumulate()` gets error against the doc

オープン
#135,282 コメント 11 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

docs type-bug
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

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
  • gh-135283

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue にリンクされている itertools.accumulate() のドキュメントから始め、シグネチャと Python の例に示されている受け付けられるキーワードを比較してください。記載されているパラメーター名を確認し、シグネチャが実際の使用方法と一致するようにドキュメントを更新してください。開始する前に、リンクされている PR gh-135283 を確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
バグ
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。