Typeclasses with several methods
還沒有人認領這個 Issue。
評估
研究方向
未指定任何檔案、測試或進入點。先追蹤目前的 typeclass 機制如何表示及繫結實作,然後確定應如何支援包含多個方法(包括 classmethod)的 Python Protocol。完成的標準是:所提出的 Functor 形式能夠正常運作,且其實作繫結已定義並有測試涵蓋。
由索引模型根據 Issue 內容生成。
描述
There's a common use-case when we need to create a type-class with several methods. Like:
class Functor(Protocol[T]):
def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
...
@classmethod
def from_value(cls, inner_value: V) -> Functor[V]:
...
Currently, there's no way we can do that.
I propose something like this:
@typeclass
class Functor(Protocol[T]):
def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
...
@classmethod
def from_value(cls, inner_value: V) -> Functor[V]:
...
I am not sure how to bound it to the actual implementation.
- 主要語言
- Python
- 星號
- 730
- 分支
- 30
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
dry-python/classes 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 35/100
dry-python/classes#496 ·
-
bug
難度 2/5 1-3 小時 新手友好度 45/100
dry-python/classes#494 ·
-
bug
難度 2/5 1-3 小時 新手友好度 52/100
dry-python/classes#492 · 2 則留言 ·
-
bug
難度 3/5 1-2 天 新手友好度 35/100
dry-python/classes#481 · 5 則留言 · 4 個 reaction ·
-
bug
難度 2/5 1-3 小時 新手友好度 35/100
dry-python/classes#386 ·
查看 dry-python/classes 的全部 Issue
相似的 Issue
-
bug confirmed issue
難度 2/5 1-3 小時 新手友好度 75/100
open-webui/open-webui#30750 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
-
good first issue
難度 1/5 1 小時以內 新手友好度 90/100