Python callable() function
Published February 15, 2022In Python, the callable() function refers to a built-in method that returns "True" if the provided object is callable and "False" if it is not. A callable object is one that can be invoked in general. For example, if you declare a variable with a value, it is not callable until you write a function that makes it callable. A callable object is one with a call method.
Example
In the example below, a callable object will be returned. We have declared a function to make our variable callable.
def func_callable(): x = y = 6 z = x^y return z a = func_callable print(callable(a)) print(a) b=func_callable() print(b) |
The output
Article Contributed By :
|
|
|
|
315 Views |