
From a runtime type inspection perspective I'm avoidant of scoping rules being introduced that would case accessing type variable outside that scope to be an error. As a simple example, class Foo(Generic[T]): value: T type_hints = get_type_hints(Foo) currently returns {"value": T}. Several libraries do want to access a type variable being there outside of the class. It can be useful for documentation generation, serialization code based on types, or runtime validation checks. T needs to not be deleted I think for this to work. A more niche case I'd like to have some working equivalent is, class Foo(Generic[T]): value: T Foo.__orig_bases__ currently gives Generic[T]. Some way of getting the type variables that class is parameterized by would be nice to have. This one I'm more ok if exact code needs to change given __orig_bases__ is minimally documented as long as information stays inspectable. auto_variance would be nice to have utility function in standard library/typing inspect to identify which variance each type variable has at runtime. This is minor though. I think runtime variance usage is rather rare.