>>> import inspect
>>> import numpy as np
>>> inspect.getargspec(np.abs)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\inspect.py", line 815, in getargspec
raise TypeError('{!r} is not a Python function'.format(func))
TypeError: <ufunc 'absolute'> is not a Python function
所以inspect
不返回函数的参数numpy
,因为它不将其识别为函数,而numpy
似乎没有帮助函数返回函数的参数。
有谁知道如何获取任意 numpy 函数的参数?