Skip to main content

Callable

Type annotation for callable objects (e.g. functions).

This is a generic type whose parameters indicate the argument types and return type of the object.

Examples

def f(i: int, s: str) -> bool:
...

# would be matched by:

typing.Callable[[int, str], bool]

See also typing.Callable in the Python documentation.