# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法callable(),仅作了解 #callable() #说明:判断对象object是否可调用。如果可以返回True,object仍然可能调用失败;但如果返回False,调用对象ojbect绝对不会成功 #函数也可以是一个Object,类也可以是Object ‘‘‘ callable(...) 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. ‘‘‘ name=‘xiaodeng‘#是对象,但不是可调用对象 print callable(name)#False key=range(5) print callable(key)#False class A(): pass print callable(A)#True
时间: 2024-10-10 21:38:11