[Typing] `batched` revealed type?
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
Bug report
Bug description:
Hi!
Consider the following.
from functools import reduce
from itertools import batched
x = reduce(batched, [1], (1,))
It makes mypy unhappy!
error: Argument 1 to "reduce" has incompatible type "type[batched[Any]]"; expected "Callable[[tuple[int], int], tuple[int]]" [arg-type]
I did try to previously type hint the tuple with
the_tuple: tuple[int, ...] = (1,)
But the error remains the same.
It may be that I'm not understanding something elementary in which case, thanks for the help! Otherwise, is this a problem of batched or something deeper?
Thanks!
CPython versions tested on:
3.13
Operating systems tested on:
Linux
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告ではファイルパスもテストパスも指定されていません。まず itertools.batched の typeshed スタブと reduce の型付けを調べ、次に Python 3.13 の例で提示された mypy エラーを再現してください。意図された動作が解決され、適切な typeshed チェックでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- developer-experience
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100