Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Python – Find Object Callable – callable() Function with Examples

callable() function is used to find the object callable in Python, if it appears callable, true will return (remember that it is still possible that a call fails) and false will return if it is not callable (in this case calling the object will never be succeeded).
callable() function is a part of Python Built-in Functions.

 

Syntax of callable() Function

The syntax of callable() function in Python is:

 

Parameters of callable() Function in Python

x – Where object is any object.

 

Compatibility

callable() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of callable() Function in Python

callable() function return boolean values true or false, it return true if the object is callable and return false if the object is not callable. callable() return false if the function fails.

 

Python callable() Function Example 1


Output:
False
True

 

Python callable() Function Example 2


Output:
True
Some print text

 

Python callable() Function Example 3


Output:
True

 

Python callable() Function Example 4


Output:
True
Error: 'MyThirdClass' object is not callable

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved