Python callable() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
Built-in

Definition

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()
CallWhat 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

ParameterDescription
objectRequired. Any value.

Return Value

Return ValueDescription
boolTrue 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.

python
def greet():
    return "hi"


print(callable(greet))
print(callable(len), callable(str))
print(callable("greet"), callable(42))
print(callable(lambda: None))

How It Works

  1. Functions. Anything defined with def is callable.
  2. Classes are callable. str is a class; calling it creates a string.
  3. A name is not a function. The string "greet" is just text, so it is not callable.
  4. Lambdas. A lambda is a small anonymous function and is callable.

Example 2 — Make Instances Callable with __call__

Write a class whose instances can be called like functions and keep their own settings.

python
class Multiplier:
    def __init__(self, factor):
        self.factor = factor

    def __call__(self, value):
        return value * self.factor


triple = Multiplier(3)
print(callable(triple), triple(7))
print(callable(Multiplier))
print(list(map(triple, [1, 2])))

How It Works

  1. __call__ hook. triple(7) runs Multiplier.__call__(triple, 7).
  2. Stateful function. The instance remembers its factor, 3, between calls.
  3. The class too. Multiplier itself is callable, since calling it builds an instance.
  4. 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)))

How It Works

  1. Call if possible. resolve() runs the lambda for port and returns the other values unchanged.
  2. Lazy defaults. Storing a function lets a value be computed only when it is needed.
  3. Validate callbacks. Checking a list of handlers spots the string that cannot be called.
  4. None vs its class. None is not callable, but its class NoneType is.

Frequently Asked Questions

callable(x) tells you whether it can be called. inspect.isfunction(x) is stricter and only accepts plain Python functions.
Yes. Calling a class creates a new instance, so callable(SomeClass) is True.
Define a __call__(self, ...) method in its class.
Not necessarily. Wrong arguments or errors inside the function can still raise exceptions.
You used parentheses on something that is not a function, often because a variable shadows a function name, like list = [1, 2] then list(...).

Next: chr()

Character for a Unicode code point number.

chr() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful