idiombench / Python /train /3.8 /protocol /modern_30.py
SwashBuckler001's picture
IdiomBench (part 10)
c6ed2d8 verified
Raw History Blame Contribute Delete
216 Bytes
T = TypeVar('T')
class P(Protocol[T]): # Protocol is declared as invariant.
def meth(self) -> T:
...
class C:
def meth(self) -> float:
...
class D(C):
def meth(self) -> int:
...