Skip to content

How to annotate a variable referring to an already defined function? #1038

Answered by TeamSpen210
geeshta asked this question in Q&A
Discussion options

You must be logged in to vote

There’s two ways you can annotate this. First you could just duplicate the function definition under the second name. Secondly, if you do want to specify it as more of a global variable that may be changed, you can use a Protocol containing only a __call__ method as effectively an advanced Callable type.

Replies: 1 comment

Comment options

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