PyDocs

Nav

Development Tools

Callable

typing

dataDeprecated 3.9
Deprecated since 3.9. collections.abc.Callable now supports subscripting ([]). See PEP 585 and Generic Alias Type.
Deprecated alias to collections.abc.Callable.

Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.

The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.

There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
Changed in 3.10
  • 3.10: Callable now supports ParamSpec and Concatenate. See PEP 612 for more details.
0 Examples
No examples for typing/Callable.
See Also
No see-alsos for typing/Callable
0 Notes
No notes for Callable