Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created May 24, 2024 22:00
Show Gist options
  • Save mypy-play/95be80b2ef05cc43ed77677df133d9d5 to your computer and use it in GitHub Desktop.
Save mypy-play/95be80b2ef05cc43ed77677df133d9d5 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Protocol, final
@final
class Inter(Protocol):
x: int
def y(self) -> int:
...
class Implement:
def __init__(self):
self.x = 2
def y(self) -> int:
return self.x + 10
obj: Inter = Implement()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment