如题所述
>>> import types
>>> isinstance(open, types.FunctionType)
False
>>> callable(open)
True
>>> isinstance(open, types.FunctionType)
False
>>> callable(open)
True
上面的例子可以说明isinstance判断是不是一个函数对象是不怎么靠谱的,判断是不是一个函数对象最好用callable
温馨提示:答案为网友推荐,仅供参考