Skip to content

typing.Callable and type hint of decorated method #99

Answered by coady
paivan1999 asked this question in Q&A
Discussion options

You must be logged in to vote

Your example works if t is defined as:

def t(arg: int) -> int:
        return arg

Whereas with t:Callable[[int],int] = lambda arg:arg, there is no way to know the function signature.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@paivan1999
Comment options

Answer selected by coady
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