What is the appropriate type hint to specify that a variable should be a function (the equivalent of a delegate, Func<T>
or Action
in C#)?
Is it also possible to specify the function argument types in a generic fashion as well (for example Func<int, int>
)?
I cannot find any relevant details in the documentation.
来源:https://stackoverflow.com/questions/35315824/in-python-3-5-how-can-i-specify-a-function-as-a-type-hint