Literal for sentinel values
還沒有人認領這個 Issue。
評估
研究方向
尚未確定任何實作檔案、測試或進入點。首先檢視 sentinel 值提案及其中引用的 typeshed 討論,然後確定應接受哪些語法和語意。完成的要求是達成共識的設計,並提供相應的實作和測試,但該 issue 未定義這些細節。
由索引模型根據 Issue 內容生成。
描述
This came up python/typeshed#3521: Currently I can't think of a way to type sentinel values that are often constructed by allowing a certain instance of object as the argument. For the example above it would be useful to be able to do something like this:
class PSS(AsymmetricPadding):
MAX_LENGTH: ClassVar[object]
def __init__(self, mgf: MGF1, salt_length: Union[int, Literal[MAX_LENGTH]]) -> None: ...
Alternatively we could add a type like Singleton type to typing:
class PSS(AsymmetricPadding):
MAX_LENGTH: Singleton
def __init__(self, mgf: MGF1, salt_length: Union[int, MAX_LENGTH]) -> None: ...
- 主要語言
- Python
- 星號
- 1.8k
- 分支
- 302
- 平均合併
- 23 小時
- 30 天內合併 PR
- 8
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python/typing 的其他 Issue
-
topic: typing spec
難度 2/5 1-3 小時 新手友好度 72/100
-
topic: typing spec
難度 2/5 1-3 小時 新手友好度 75/100
-
topic: documentation
難度 2/5 1-3 小時 新手友好度 76/100
-
topic: documentation
難度 2/5 1-3 小時 新手友好度 65/100
-
topic: conformance tests topic: typing spec
難度 3/5 1-2 天 新手友好度 72/100
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main 未關閉area: ci bug perceived difficulty: 3
難度 2/5 1-3 小時 新手友好度 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 2/5 1-3 小時 新手友好度 78/100
ClickHouse/clickhouse-connect#1057 ·