Skip to content

Instantly share code, notes, and snippets.

@podhmo podhmo/
Created Oct 12, 2019

What would you like to do?
import typing as t
import typing_extensions as tx
$ mypy --strict
class HasName(tx.Protocol):
def name(self) -> str:
class Person:
name: str
def __init__(self, name: str) -> None: = name
class Display:
def __init__(self, typ: t.Type[t.Any]) -> None:
self.typ = typ
def name(self) -> str:
return self.typ.__name__
def get_name(o: HasName) -> str:
def main() -> None:
# get_name(object())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.