I am writing some code, and I want to make it clear that the input of this function is a function, but I cannot figure out what the type hint should be.
For example, I am trying to write code like this:
def function_1(x: str) -> str:
return x + ' world'
def function_2(function) -> str:
return function('hello')
function_2(function_1)
>> 'hello world'
What should the type hint of the input parameter of function_2 be?
If I do def function_2(function: function), my IDE gives me red squiggly lines under the function and tells me to install it and import it, but in the python console I get:
In [1]: type(function_2)
Out[1]: function
Also what would the type-hint be for passing a method in as well?