Menu Close

Python callable() Function

In this tutorial, you will learn all about Python callable() function to check a specified object is callable or not. This is best python built-in function to check a object is callable or not.

In the previous python tutorial, we have seen all about the Python bool() function to return the Boolean value of the specified object.

Python callable() function

Python callable function is a built-in function. The callable() function returns True if the specified object is callable, otherwise it returns False.

Syntax

The syntax of callable function in Python.

callable( object )

Return Value

callable function in Python accepts one parameter.

  • object:– object that you want to test if callable or not.

Return value

Return value of callable function in python is always True or False.

Python callable function example

Here we will take various examples to understand python callable function.

Example 1:

Here we will check a integer object callable or not.

x = 10
print(callable(x))

Output will be:- False

Example 2:

Here we will check a function is callable or not.

def y():
    x = 10
    print(x)
    
print(callable(y))

Output will be:- True

Conclusion

In this tutorial, you have learned all about callable function in python. This is the best function to check whether a object is callable or not. If this article helped you, please share and keep visiting for further Python built-in functions tutorial.

Other Python built-in functions


For more information:- Click Here

Python all() function
Python chr() Function

Related Posts