mypy generics - limit the types by listing



examples/python-types-at-pyweb-2025-01/generics_limit_types_by_listing.py
from typing import TypeVar

T = TypeVar('T', int, str)

def add(x: T, y: T) -> T:
    return x + y

add(2, 3)