Skip to content

Instantly share code, notes, and snippets.

View ktbarrett's full-sized avatar

Kaleb Barrett ktbarrett

  • Hudson River Trading
  • Boulder, CO
View GitHub Profile
@ktbarrett
ktbarrett / main.py
Created February 24, 2022 03:33 — forked from mypy-play/main.py
Shared via mypy Playground
from typing import *
K_contra = TypeVar("K_contra", contravariant=True)
K_co = TypeVar("K_co", covariant=True)
V_co = TypeVar("V_co", covariant=True)
V = TypeVar("V")
T = TypeVar("T")
class ContravariantMapping(Protocol[K_contra, V_co]):
def __getitem__(self, __key: K_contra) -> V_co: ...