Spec and conformance tests disagree on converting constructors into callable for classes with `__new__` and `__init__`
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 48/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
比較 docs/spec/constructors.rst 中連結章節附近所描述的建構函式行為與 conformance/tests/constructors_callable.py 中的案例。確定對於同時定義 new 和 init 的類別,預期使用哪種 callable 類型,接著對齊規格與一致性測試,並執行相關的建構函式一致性檢查。
由索引模型根據 Issue 內容生成。
描述
For classes with both __new__ and __init__, when converting the constructor into a Callable, the spec says that
class B:
""" __new__ and __init__ """
def __new__(cls, *args, **kwargs) -> Self:
...
def __init__(self, x: int) -> None:
...
reveal_type(accepts_callable(B)) # ``def (*args, **kwargs) -> B | def (x: int) -> B``
The conformance test says that
- 主要語言
- Python
- 星號
- 1.8k
- 分支
- 302
- 平均合併
- 4 小時 16 分鐘
- 30 天內合併 PR
- 7
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
python/typing 的其他 Issue
-
topic: typing spec
難度 2/5 1-3 小時 新手友好度 72/100
python/typing#2356 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
topic: typing spec
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
topic: documentation
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
topic: documentation
難度 2/5 1-3 小時 新手友好度 65/100
python/typing#2150 · 2 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
topic: conformance tests topic: typing spec
難度 3/5 1-2 天 新手友好度 72/100
維護者通常 1 天內回覆
相似的 Issue
-
New Internship未關閉new_internship
難度 1/5 1 小時以內 新手友好度 70/100
-
[BUG] Reports tab: "Unban" button tooltip shows raw `{{ip}}` placeholder instead of the IP address未關閉bug javascript ui
難度 2/5 1-3 小時 新手友好度 68/100
bunkerity/bunkerweb#4001 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 92/100
PedestrianDynamics/pyFDS-Evac#476 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
google/differential-privacy#516 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
adobe-fonts/source-serif#153 ·