Suppose you want to constrain a type variable to implement a certain interface. You might write something like so:
from typing import TypeVar, Callable
T = TypeVar('T', Callable)
class Foo(Generic[T]):
...
>> TypeError: A single constraint is not allowed
Why is Python unhappy about this use of type constraints? PEP 484 and the Python source code are unhelpful in this regard.
Note: in my particular case I am interested in constraining a type variable to implement an abstract base class, but the principle is the same.