Skip to content

Instantly share code, notes, and snippets.

@giuliano-macedo
Last active January 4, 2023 13:11
Show Gist options
  • Save giuliano-macedo/7d2194c9fcdd8f8071ccbd173461e037 to your computer and use it in GitHub Desktop.
Save giuliano-macedo/7d2194c9fcdd8f8071ccbd173461e037 to your computer and use it in GitHub Desktop.
T = TypeVar("T")
class MyProtocol(Protocol[T]):
def my_method(self, first_param: int, args: T) -> int:
...
@dataclass
class Imp1Args:
x: float
y: float
class Imp1(MyProtocol[Imp1Args]):
def my_method(self, first_param: int, args: Imp1Args) -> int:
return int(args.x + args.y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment