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
PEP-612 Concatenate not recognized properly #11833
from typing import Concatenate, Callable, TypeVar, ParamSpec
R = TypeVar('R')
P = ParamSpec('P')
class Request:
pass
def with_request(f: Callable[Concatenate[Request, P], R]) -> Callable[P, R]:
def inner(*args: P.args, **kwargs: P.kwargs) -> R:
return f(Request(), *args, **kwargs)
return inner
then
$ mypy t6.py
t6.py:9: error: The first argument to Callable must be a list of types or "..."
Found 1 error in 1 file (checked 1 source file)
I would expect Concatenate to be accepted as the first argument of Callable.
Mypy 0.930, Python 3.10.1
Reacted by Dmitrii Volodin, Brieuc Loussouarn, Régis Behmo, SubaruArai, Maddy Guthridge, KotlinIsland, Alexander Rodionov, Julien Palard and Jarek Głowacki
Without recognizing Concatenate, one has to use args as a tuple (i.e. access first argument with args[0]), which is disallowed by PEP-612 and Mypy (see also #11826).
Activity
wrobell commentedon Dec 23, 2021
Without recognizing Concatenate, one has to use args as a tuple (i.e. access first argument with
args[0]), which is disallowed by PEP-612 and Mypy (see also #11826).srittau commentedon Dec 23, 2021
Part of #8645
Basic ParamSpec Concatenate and literal support (#11847)