Python Tutorial Python Advanced Python References Python Libraries

Python callable() Function



The Python callable() function is used to check whether the specified object is callable or not. It returns true when the specified object is callable, else returns false.

Syntax

callable(object)

Parameters

Object Required. specify object which need to be checked whether it is callable or not.

Example:

In the example below, the callable() function is used to check whether the function called MyFunction is callable or not. As MyFunction is a callable object it returns True.

def MyFunction():
  print("Hello World!.")

x = callable(MyFunction)
print(x)

The output of the above code will be:

True

Example:

In this example, the callable() function checks whether the list called MyList is callable or not. Since, MyList is not a callable object it returns False.

MyList = [1, 2, 3, 4, 5]

x = callable(MyList)
print(x)

The output of the above code will be:

False

❮ Python Built-in Functions