dry-python / dry-python/classes

Support `Literal` types

オープン
#274 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
730
フォーク
30
PR マージ指標
30日以内にマージされた PR はありません

説明

After we have `delegate` in-place we can use `Literal` types.

But, now they are not supported.
Ideally, something like this should work:

```python
from classes import typeclass, AssociatedType, Supports
from typing_extensions import Literal

class SomeDelegate(object):
... # TODO: write proper `__instancecheck__`

class A(AssociatedType):
...

@typeclass(A)
def some(instance) -> int:
...

@some.instance(Literal[1], delegate=SomeDelegate)
def _some_tuple(instance: Literal[1]) -> int:
return instance

def test(i: Supports[A]):
return some(i)

some(1)
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。