Next / Previous / Contents / TCC Help System / NM Tech homepage

21.2. callable(): Is this thing callable?

This predicate tests whether some value x can be called as a function.

callable(x)

Class names can be called to create an instance of the class. Instances can be called if they define a .__call__() special method; see Section 26.3.5, “__call__(): What to do when someone calls an instance”.

>>> def someFunction():
...     pass
... 
>>> callable(someFunction)
True
>>> callable(len)
True
>>> callable(int)
True
>>> callable(42)
False