Using `types` classes over `collections.abc`'s bases
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 302
- 平均マージ
- 23時間
- マージ済み PR(30日)
- 8
説明
Currently collections.abc.Generator/Coroutine/AsyncGenerator etc. have attributes that don't have to exist at runtime. I think it'd be wise to switch recommending to using the types concrete classes where possible over the abstract versions which have a smaller interface because having this weird sort of duplication where the 2 are basically the same is a wrinkle that's bitten me recently. To do this I think a few things need to happen:
- make the classes in
collections.abc.pyiProtocols that should be based on their runtime implementation (they implement custom__subclasshook__) and not the concrete types. (https://github.com/python/typeshed/pull/10816) - make the
typesclasses subscriptable at runtime. (https://github.com/python/cpython/pull/110212) - make type checkers infer things like
def foo(): yieldastypes.GeneratorTypeand not justcollections.abc.Generator.
(as a small aside it might be nice to move the type implementations from typing to collections.abc soon)
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず collections.abc.pyi のクラスと、関連付けられた typeshed および CPython のプルリクエストを確認します。次に、型チェッカーが generator、coroutine、async-generator 関数をどのように推論するかを調べます。特定した変更全体で、抽象型と具象型が提案された実行時および推論時の動作をすることをもって完了とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100