在python中找不到内置类型'函数'

时间:2019-08-01 11:10:23

标签: python

无法导入内置类型“函数”

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]

0 个答案:

没有答案