Callable (object)
英文说明: Check whether object is callable. If return true,object still may fail, but if return false, calling object Ojbect will never succeed.
Note: The class is callable, and an instance of the class implements the __call__ () method to invoke.
Version: This function is available in the python2.x version. However, it was removed in the python3.0 version and was re-added in the later version of python3.2.
English Description: Return True If the object argument appears callable, False if not. If this returns true, it's still possible that a call fails, and if it is false, calling object would never succeed. Note that classes is callable (calling a class returns a new instance); Class instances is callable if they has a __call__ () method.
code example:
>>> Callable (0) false>>> callable ("MyString") false>>> def add (A, B): ... Return a + b...>>> callable (add) True>>> Class A: ... Def method (self): ... Return 0...>>> callable (a) true>>> a = A () >>> callable (a) false>>> class B: ... def __call__ (self): ... return 0...>>> callable (b) true>>> B = B () >>> callable (b) True