This commit is contained in:
2025-07-11 15:11:09 +08:00
parent dbe3662088
commit 5f959b129d
8 changed files with 1464 additions and 44 deletions

16
protocol.py Normal file
View File

@ -0,0 +1,16 @@
from typing import Protocol, TypeVar, Generic
T = TypeVar("T")
class Adder(Generic[T], Protocol):
def add(self, a: T, b: T) -> T: ...
class AdderImpl(Adder[int]):
acc: int
def add(self, a: int, b: int):
self.acc = a + b
return self.acc