[Numpy-discussion] Why are ufunc docstrings useless?

Robert Kern robert.kern at gmail.com
Thu May 8 18:45:26 EDT 2008


On Thu, May 8, 2008 at 5:28 PM, Anne Archibald
<peridot.faceted at gmail.com> wrote:
> Hi,
>
> I frequently use functions like np.add.reduce and np.add.outer, but
> their docstrings are totally uninformative. Would it be possible to
> provide proper docstrings for these ufunc methods? They need not be
> specific to np.add; just an explanation of what arguments to give (for
> example) reduce() (presumably it takes an axis= argument? what is the
> default behaviour?) and what it does would help.

Sure. The place to add them would be in the PyMethodDef ufunc_methods
array on line 3953 of numpy/core/src/ufuncobject.c. Just extend each
of the rows with a char* containing the docstring contents. A literal
"string" will suffice.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list