In Python, callable(obj) returns True if obj(...) could be called: functions, lambdas, built-in functions, methods, and classes (calling a class creates an instance). Strings, numbers, and lists are not callable.
Instances of your own class are callable when the class defines a __call__ method. That makes objects that behave like functions but also keep state, such as a configurable multiplier.
callable() is a built-in function: it lives in the builtins module, so it is always available without an import.
Syntax
Pass any object.
python
if callable(value):
result = value()
Call
What it does
callable(len)
Returns True.
callable(str)
Returns True: classes are callable.
callable("text")
Returns False.
callable(obj)
True if type(obj) defines __call__.
True means the object can be called, not that a call with your arguments will succeed.
Library declarations
python
callable(object, /)
Parameters
Parameter
Description
object
Required. Any value.
Return Value
Return Value
Description
bool
True if the object appears callable.
Python Examples
Example 1 — Functions, Classes, and Plain Values
Check functions, a built-in class, a lambda, and non-callable values.
Stateful function. The instance remembers its factor, 3, between calls.
The class too.Multiplier itself is callable, since calling it builds an instance.
Works anywhere a function does.map() happily accepts the callable object.
Example 3 — Values That May Be Functions
Call settings that are functions and keep the plain values as they are.
python
def resolve(value):
return value() if callable(value) else value
settings = {"name": "app", "port": lambda: 8000 + 80, "debug": False}
print({key: resolve(v) for key, v in settings.items()})
handlers = [print, "not a function", str.upper]
print([callable(h) for h in handlers])
print(callable(None), callable(type(None)))