I'm using mypy and the typing module in python. Imagine I have a generic type:
ContainerT = TypeVar('ContainerT')
class Thingy(Generic[ContainerT]):
pass
However I want to get at another type inside the concrete type associated with the TypeVar like in the example below:
class SomeContainer(object):
Iterator = SomeCustomIterator
ContainerT = TypeVar('ContainerT')
class Thingy(Generic[ContainerT]):
def foo(self) -> ContainerT.Iterator:
pass
I get an error saying that TypeVar does not have a member Iterator. Is there another way to reformulate this so I can associate one type with another?
Thank you.