Created
May 24, 2024 22:00
-
-
Save mypy-play/95be80b2ef05cc43ed77677df133d9d5 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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