猿问

如何获取Python类型的签名,例如Exception

我想要得到的签名Exception.__init__使用inspect模块,但使用inspect模块上的Python类型,如Exception 与None失败,下面的错误。


/usr/lib/python2.7/inspect.pyc in getargspec(func)

    814         func = func.im_func

    815     if not isfunction(func):

--> 816         raise TypeError('{!r} is not a Python function'.format(func))

    817     args, varargs, varkw = getargs(func.func_code)

    818     return ArgSpec(args, varargs, varkw, func.func_defaults)


TypeError: <method-wrapper '__init__' of NoneType object at 0x8ff8d0>

is not a Python function

我想知道如何获取在Python中定义的类型的内置函数的签名。


MM们
浏览 161回答 1
1回答
随时随地看视频慕课网APP

相关分类

Python
我要回答