Python: callable() function
callable() function
The callable() function returns True if the object argument appears callable, False if not.
Syntax:
callable(object)
Version:
(Python 3.2)
Parameter:
Name | Description |
---|---|
object | A callable is anything that can be called. |
Return value:
boolean
Example: Python callable() function
a = 10
print(callable(a))
def testFunction():
print("Test")
b = testFunction
print(callable(b))
Output:
False True
Example: Callable Object
class Foo:
def __call__(self):
print('Print Python callable objects')
print(callable(Foo))
Output:
True
Python Code Editor:
Test your Python skills with w3resource's quiz
Python: Tips of the Day
How do I check if a list is empty?
For example, if passed the following:
a = [] if not a: print("List is empty")
Ref: https://bit.ly/2A4JXx9
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework