Python: How to specify type hints of a function that returns an attribute of a class with generic types?
Python: How to specify type hints of a function that returns an attribute of a class with generic types? Question: import typing as typ T = typ.TypeVar("T") class Foo(typ.Generic[T]): """The generic class.""" def __init__(self, var: T): self.var = var def var_getter(foo_obj: ??) -> ??: """Var getter.""" return foo_obj.var These are the test cases that should …