In Python, the callable function is used to determine whether an object can be called as a function. This built-in function evaluates the object provided to it and returns True if the object is deemed callable; otherwise, it returns False.
Python callbale Function Syntax
It has the following syntax:
Example
callable(object)
Parameters
object - The entity you wish to evaluate to determine whether it can be called or not.
Return
Returns True if the object can be called, and False if it cannot.
Different Examples for Python callable Function
Let us explore a few instances of the callable function in Python.
Python callable Function Example 1
Check if a function is callable:
Example
def x():
a = 5
print(callable(x))
Output:
Python callable Function Example 2
Verify if a function is non-callable (for instance, like a standard variable).
Example
x = 5
print(callable(x))
Output: