Consider adding a "TopLevel" keyword that stands in for the top level bound of a corresponding type variable
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 302
- 平均マージ
- 23時間
- マージ済み PR(30日)
- 8
説明
Summary
Please consider a new typing keyword that stands in for the top level type of a corresponding type variable.
Motivation
Consider a test here and the corresponding definition of DistributionInfo here. The test loses all typing information because I used DistributionInfo[Any, Any, Any]. So if I want typing information, I have to use:
def test_flatten(generator: Generator,
distribution_info: DistributionInfo[NaturalParametrization[ExpectationParmetrization, JaxComplexArray],
ExpectationParametrization[NaturalParmetrization],
NumpyComplexArray]) -> None:
I would much rather just do
def test_flatten(generator: Generator,
distribution_info: DistributionInfo[TopLevel, TopLevel, TopLevel]) -> None:
It's not just shorter, but it reduces churn if the type definitions change. Note that TopLevel is recursive (it chooses the top level of the nested types too).
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている tests/test_flatten.py と tests/distribution_info.py から始め、DistributionInfo[Any, Any, Any] が使用されたときにどの型情報が失われるのかを理解してください。TopLevel の意図された再帰的セマンティクスと、それが既存の型変数の挙動とどのように異なるのかを明確にしてください。提案に明確な仕様と合意済みの検証方法が含まれていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100