Skip to content
Discussion options

You must be logged in to vote

I don't see a way to do this if you want to preserve the ability to use the first parameter as a keyword parameter. If you're willing to assume that the first parameter is always used as a positional-only parameter, then you can use Concatenate.

def add_logging_with_first_arg(
    f: Callable[Concatenate[str, P], T]
) -> Callable[Concatenate[str, P], T]: ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lexdene
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