type annotation in the function arguments definition: I want to implement a High Order Function in python, and for that I would like to have explicit arguments type. Is there a way to show a 'function' type?
def high_order_math(a: Float, b: Float, func: function):
return func(a,b)
Here are some findings, appreciate you all that have shared your knowledge
def high_order_math(a: float, b: float, func: Callable[[float, float], float]) -> float:
return func(a, b)
high_order_math(1,2,3)
Traceback (most recent call last):
File "", line 1, in
File "", line 2, in high_order_math
TypeError: 'int' object is not callable