[Numpy-discussion] numpy.vectorize docstrings not shown by help command

John Haiducek jhaiduce at gmail.com
Fri Sep 5 13:40:52 EDT 2014

When I apply numpy.vectorize() to a function, documentation tools behave inconsistently with regard to the new, vectorized function. The function's __doc__ attribute does contain the docstring of the original function as expected, but the built-in help() command displays the documentation of the numpy.vectorize class, and sphinx-autodoc fails to display the function at all. Is there a way to get the docstring of the original function display everywhere as expected?

For instance:

>>> import numpy as np
>>> def myfunc(x):
...     "Square x"
...     return x**2
>>> myfunc=np.vectorize(myfunc)
>>> print myfunc.__doc__
Square x
>>> help(myfunc)
(displays documentation of np.vectorize)

More information about the NumPy-Discussion mailing list