You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify the valid use locations of typing.Concatenate #2140
@A5rocks, in your example, Concatenate[int, P_2] somewhat finally lands as a first argument to Callable, just indirectly.
This snippet previously defined:
P_2=ParamSpec("P_2")
classX(Generic[T, P]):
f: Callable[P, int]
x: T
However, it seems that the current situation (confirmed with mypy, pyright and ty) is that you can use Concatenate in all valid locations of ParamSpec except directly in a Concatenate. I.e., you can't do Concatenate[int, Concatenate[str, P]]), but you can (besides passing Concatenate form as the first argument to Callable):
and mypy accepting Concatenate in a tuple is a bug. I've filed a report: python/mypy#20452
The only other point I see is that Concatenate[int, ...] is allowed despite not being in the PEP, but this is something that changed in the typing docs:
Activity
A5rocks commentedon Dec 21, 2025
To be clear, this is what the PEP specifies. It notes that:
and:
A5rocks commentedon Dec 21, 2025
and mypy accepting
Concatenatein atupleis a bug. I've filed a report: python/mypy#20452The only other point I see is that
Concatenate[int, ...]is allowed despite not being in the PEP, but this is something that changed in the typing docs:Concatenatemicrosoft/pyright#5715Ellipsisas last argument forConcatenate. mypy#14656