Nov. 1, 2021
1:07 a.m.
Thanks for clearing that up. But this is a pretty confusing thing to me. For instance, consider this example ``` from typing import TypeVar class A: ... class B: ... class C(A): ... T = TypeVar("T", A, B) def f(x: T) -> T: return x x = C() reveal_type(x) reveal_type(f(x)) ``` Output: ``` main.py:13: note: Revealed type is "__main__.C" main.py:14: note: Revealed type is "__main__.A*" ``` Up to now, I always assumed that a type parameter simply binds to the type of its value. However, in this example, that would imply that `T != T`. This assumption is one that I think most people have, and as far as I know, this is the only exception to it.