Skip to content

Why does Concatenate only work one way? #2167

Answered by layday
decorator-factory asked this question in Q&A
Discussion options

You must be logged in to vote

It's because Callable only supports expressing positional arguments. If you have Callable[Concatenate[P, int], None], then what should P capture? It can't capture kwargs so that's a limitation that'd have to be imposed on ParamSpec in this context. But also, if you imagine this as def foo(*args, bar: int), what that means is the int would have to be a keyword-only argument, and keyword-only arguments are not supported by Callable.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by decorator-factory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants