How to statically get TypeVar parameters from a Generic for use in static type checking?
问题 I have a class that inherits from typing.Generic and passes in one TypeVar as the parameter. Later on in the code, I would like to: Statically (not at runtime) get the TypeVar parameter out from the class Alias it to another type variable Use that alias to type hint the return of a function Is there some way in Python that I can make this happen? The only piece I am missing is step 1, how to get the type parameter out of a type variable My Use Case from abc import ABC, abstractmethod from