Python 3 reference · Built-in Functions

Python callable() Function

Return True if an object can be called like a function: functions, classes, methods and objects with __call__().

Python 3 Since 3.2

Syntax

callable(object)

Parameters

ParameterDescription
object Any object.

Return value

True if the object appears callable, otherwise False.

Examples

What can be called?Try it yourself
print(callable(print))
print(callable(len))
print(callable(int))      # classes are callable
print(callable(42))
print(callable("hello"))

Output

True
True
True
False
False
Objects with __call__Try it yourself
class Greeter:
    def __call__(self, name):
        return f"Hello, {name}"

greet = Greeter()
print(callable(greet), greet("Ada"))

Output

True Hello, Ada

Good to know

callable() was removed in Python 3.0 and brought back in Python 3.2. A True result means calling is possible, not that it will succeed with the arguments you pass.

Version history

VersionChange
Python 3.2Added