本文摘自php中文网,作者巴扎黑,侵删。
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, but if it is false, calling object will never succeed. Note that classes are callable (calling a class returns a new instance); class instances are callable if they have a __call__() method.
代码实例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
以上就是python函数之callable(object)的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
Python将dataframe的某一列作为index的方法
Python中根据字符串导入模块module的方法介绍(附代码)
学习使用Python的statsmodels模块拟合arima模型
更多相关阅读请进入《Python》频道 >>

Python编程 从入门到实践 第2版
python入门书籍,非常畅销,超高好评,python官方公认好书。