Find out if an Python object is callable

Use the builtin callable():

>>> callable(open)
True
>>> print(callable.__doc__)
callable(object) -> bool

Return whether the object is callable (i.e., some kind of function).
Note that classes are callable, as are instances with a __call__() method.

It’s a great investment making an effort to master at least 90% of the builtin functions listed here: https://docs.python.org/3/library/functions.html

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)