无法导入内置类型“函数”
def foo(a, b):
return a+b
if isinstance(foo, function):
print('yes')
'function'是python中的内建类型,但出现错误'NameError:未定义名称'function''
我也找到了类的定义
class function:
# TODO not defined in builtins!
__name__ = ... # type: str
__qualname__ = ... # type: str
__module__ = ... # type: str
__code__ = ... # type: CodeType
__annotations__ = ... # type: Dict[str, Any]