Skip to content

Instantly share code, notes, and snippets.

@jaycosaur
Created August 9, 2020 13:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jaycosaur/47c6c59a5168f0b5874de8f169bff3d0 to your computer and use it in GitHub Desktop.
Hybrid [python-protocol] - Typescript to Python field guide
from typing import Protocol
class Dog(Protocol):
type: str
def __call__(self, food: str) -> None:
pass
class Poodle:
type = "Poodle"
def __call__(self, food: str) -> None:
print(f"Eating {food}.")
poodle: Dog = Poodle()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment