TypeDict "dict style" positional arguments
オープン
まだ誰も着手していません。
topic: documentation
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 302
- 平均マージ
- 23時間
- マージ済み PR(30日)
- 8
説明
Hi.
I'm just curious why passing arguments to TypeDict is strictly constrained. I tried some variants including positional arguments style and failed. It's not reflected in docs or function signature (ctrl + p in Pycharm)
https://docs.python.org/3/library/typing.html#typing.TypedDict
In [1]: from typing import TypedDict
In [2]:
...: ProfileText = TypedDict(name='ProfileText', fields={'name': str, 'non variable key': str}, total=False) # Error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-7d3b7c9254f3> in <module>
----> 1 ProfileText = TypedDict(name='ProfileText', fields={'name': str, 'non variable key': str}, total=False) # Error
TypeError: _typeddict_new() missing 1 required positional argument: 'typename'
In [3]:
...: ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, total=False) # Error
In [4]:
...: ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, False) # Error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-b3b55e028c98> in <module>
----> 1 ProfileText = TypedDict('ProfileText', {'name': str, 'non variable key': str}, False) # Error
TypeError: _typeddict_new() takes from 2 to 3 positional arguments but 4 were given
In [5]:
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue では TypedDict のエントリポイントと Python typing のドキュメントに言及しているため、まず示されているキーワード引数形式と位置引数形式の呼び出しを、そのドキュメントと比較します。どの呼び出し規約をサポートすべきかを判断し、受け入れる形式について、動作、シグネチャ情報、ドキュメント、テストが整合していることを完了の定義とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100