Can someone explain why inheriting from unparameterized and parameterized Callable
:
from typing import Callable
from typing import NoReturn
from typing import TypeVar
T = TypeVar('T', str, int)
C = Callable[[T], NoReturn]
class Foo(Callable):
def __call__(self, t: T):
pass
class Bar(C):
def __call__(self, t: T):
pass
when passed to mypy raises errors for both Foo
and Bar
:
tmp.py:13: error: Invalid base class
tmp.py:19: error: Invalid base class