+ name ... >>> greeting.__annotations__ {'name': <class 'str'>, 'return': <class 'str'>} Almost nothing happens at runtime. Use mypy to analyse type hints.
= TypeVar('T', int, float, complex) # type variable Vector = Iterable[T] # type alias def dot_product(a: Vector[T], b: Vector[T]) -> T: return sum(x * y for x, y in zip(a, b)) dot_product([1, 2], [3, 4]) # OK dot_product(['1', '2'], ['3', '4']) # incompatible type