Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created May 24, 2024 08:30
Show Gist options
  • Save mypy-play/00a6e6dc238a7c020bb146fdc08d064f to your computer and use it in GitHub Desktop.
Save mypy-play/00a6e6dc238a7c020bb146fdc08d064f to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import TypeVar
from abc import ABC
class A(ABC):
def m(self) -> None:
print("A")
class B(A):
def m(self) -> None:
print("B")
class C(A):
def m(self) -> None:
print("C")
T = TypeVar("T", bound=A)
ls: list[T] = [B(), C()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment