callable(object)
中文說明:檢查物件object是否可呼叫。如果傳回True,object仍然可能呼叫失敗;但如果傳回False,呼叫物件ojbect絕對不會成功。
注意:類別是可呼叫的,而類別的實例實作了__call__()方法才可呼叫。
版本:此函數在python2.x版本中都可用。但在python3.0版本中被移除,而在python3.2以後版本中被重新加入。
英文說明:Return True if the object argument appears callable, False if not. If this returns true, it is still possible that a call fails, this returns true, it is still possible that a call fails are callable (calling a class returns a new instance); class instances are callable if they have a __call__() method.