instantiation. Example: a generic mapping type from typing import TypeVar, Generic KT, VT = TypeVar("KT"), TypeVar("VT") class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: pass This class can then be used as: X, Y = TypeVar("X"), TypeVar("Y") def lookup_name(mapping: Mapping[X, Y], key: X, default: Y) -> Y: try: return mapping[key] except KeyError: return default User-defined Generic types 29 / 49