How can I specify the function type in my type hints?
问题 I want to use type hints in my current Python 3.5 project. My function should receive a function as parameter. How can I specify the type function in my type hints? import typing def my_function(name:typing.AnyStr, func: typing.Function) -> None: # However, typing.Function does not exist. # How can I specify the type function for the parameter `func`? # do some processing pass I checked PEP 483, but could not find a function type hint there. 回答1: As @jonrsharpe noted in a comment, this can be