Python's definition of a callable object includes the obvious function definitions created with the def statement.
The Callable type hint is used to describe the __call__() method, a common protocol in Python. We can see several examples of this in Python 3 Object-Oriented Programming, by Dusty Phillips, from Packt Publishing.
When we look at any Python function, we see the following behavior:
>>> def hello(text: str):
... print(f"hello {text}")
>>> type(hello)
<class 'function'>
>>> from collections.abc import Callable
>>> isinstance(hello, Callable)
True
When we create a function, it will fit the abstract base class Callable. Every function reports itself as Callable. This simplifies the inspection of an argument value and helps write meaningful debugging messages.
We'll take a look at callables...