A way to relax param-spec -- AnyLike
還沒有人認領這個 Issue。
評估
研究方向
先閱讀 typing issue 1506,以及針對 Dask 的 client.submit 所提出的 AnyLike 用法。定義 P.args 和 P.kwargs 的預期語意,包括引數數量和關鍵字名稱,並考慮該提案如何符合現有的 ParamSpec 行為;當就新的 special form 達成一致的規格時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
What what i would really like is https://github.com/python/typing/issues/1506
however mapping types is pretty complex and general.
Consider something like Dask's client.submit
submit[T, **P](self, func: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> Future[T]
What it actually wants is any type in the outer arguments can be
either the original type Q, in P.args or P.kwargs, or Future[Q].
But specifying that is a bit fiddly.
A less complex thing would be to introduce a special form AnyLike
which can be run as
submit[T, **P](self, func: Callable[P, T], *args: AnyLike[P].args, **kwargs: AnyLike[P].kwargs) -> Future[T]
which would have the effect of allowing the types in
args to be Any but the number must match that in the paramspec P,
and similar the types in kwargs can be Any but the names must till match those in the paramspec P
- 主要語言
- 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
-
triage/confirmed
難度 2/5 1-3 小時 新手友好度 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難度 1/5 1 小時以內 新手友好度 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難度 1/5 1 小時以內 新手友好度 90/100
apache/cloudstack#14222 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
-
bug
難度 2/5 1-3 小時 新手友好度 82/100