Reputation: 25601
>>> 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
So inspect
doesn't return arguments for numpy
function, because it does not recognize it as function, while numpy
doesn't seem to have helper function that would return function's arguments.
Does anyone know how to get arguments for arbitrary numpy function?
Upvotes: 3
Views: 630
Reputation: 36662
All ufuncs have the same signature. The only differences are the number of in and outputs, and those are available as
.nin
and
.nout
– seberg Mar 27 '13 at 20:27
https://stackoverflow.com/users/455221/seberg
Upvotes: 2