Skip to content Skip to sidebar Skip to footer

In Python 3.5, How Can I Specify A Function As A Type Hint?

What is the appropriate type hint to specify that a variable should be a function (the equivalent of a delegate, Func or Action in C#)? Is it also possible to specify the

Solution 1:

According to the docs, you can use Callable, imported from typing.

You can view more details in PEP 0484.

Post a Comment for "In Python 3.5, How Can I Specify A Function As A Type Hint?"