Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
Closed
Description
The following code:
fromtypingimport*T=TypeVar('T')T2=TypeVar('T2')Ts=TypeVarTuple('Ts')classA(Generic[T,T2,*Ts]):x:List[T]y:List[T2]z:Tuple[*Ts]A[int]
is executed without errors. It is expected to get an error becauseA
requires at least two arguments.
WithoutTypeVarTuple
you get helpful errors.
classB(Generic[T,T2]):passB[int]B[int,str,bytes]
TypeError: Too few arguments for <class '__main__.B'>; actual 1, expected 2
TypeError: Too many arguments for <class '__main__.B'>; actual 3, expected 2