[Numpy-discussion] Moving docstrings from C to Python

David Huard david.huard at gmail.com
Wed Aug 9 10:35:43 EDT 2006


I started to do the same with array methods, but before I spend too much
time on it, I'd like to be sure I'm doing the right thing.

1. In add_newdocs.py, add
from numpy.core import ndarray

2. then add an entry for each method, eg
add_docstring(ndarray.var,
    """a.var(axis=None, dtype=None)
    Return the variance, a measure of the spread of a distribution.

    The variance is the average of the squared deviations from the mean,
    i.e. var = mean((x - x.mean())**2).

    See also: std
    """)

3. in arraymethods.c,
delete static char doc_var[] = ...

remove doc_var in
{"var", (PyCFunction)array_variance,
     METH_VARARGS|METH_KEYWORDS, doc_var},



David

2006/7/28, Sasha <ndarray at mac.com>:
>
> On 7/28/06, Stefan van der Walt <stefan at sun.ac.za> wrote:
>
> > Would anyone mind if the change was made?  If not, where should they
> > go? (numpy/add_newdocs.py or numpy/core/something)
>
> Another +1 for numpy/add_newdocs.py and a suggestion: check for
> Py_OptimizeFlag > 1 in add_newdoc so that docstrings are not loaded if
> python is invoked with -OO option.  This will  improve import numpy
> time and reduce the memory footprint.  I'll make the change if no one
> objects.
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060809/7f752cec/attachment.html>


More information about the NumPy-Discussion mailing list