python内置函数——callable

1、关于callable详细解说:

Signature: callable(obj, /)
Docstring:
Return whether the object is callable (i.e., some kind of function).

Note that classes are callable, as are instances of classes with a
__call__() method.
Type:      builtin_function_or_method

2、具体用法(代码示例):

>>> import math
>>> x = 1
>>> y = math.sqrt
>>> callable(x)
False
>>> callable(y)
True

作者总结了更全面的解释https://www.cnblogs.com/sesshoumaru/p/5983979.html

你可能感兴趣的:(2019.1.3)