[Numpy-discussion] numpy.var and numpy.std
oliphant.travis at ieee.org
Thu Jul 20 13:09:29 CDT 2006
Tom Denniston wrote:
> Are these functions supposed to compute variance and standard
> deviation? They don't have docstrings and I can't find anything about
> them in Travis' manual.
I just wanted to advertise the fact that there are two utility functions
in NumPy that can come in handy for people wanting to add docstrings to
These utility functions by-pass the need to fiddle with doc-strings in
C-code (which can be a pain) and re-compile every time a doc-string is
These are meant to be run once....
Add a string as the docstring of obj. A wide-variety of builtin types
are understood. If it doesn't know how to add it, you get a TypeError.
If the object already has a doc-string you get a RuntimeError.
add_newdoc(place, obj, doc)
This is a wrapper around docstring to make it easier to add docs to many
attributes of an object which is stored in place. It never fails.
place and obj are both strings
doc is a string, list, or tuple
place is the module name
obj is the object in that module
If doc is a string add it to place.obj
If doc is a tuple it is (attr, doc) ---> the first element is the
attribute of obj and the second is the docstring.
If doc is a list it is [(attr1, doc1), (attr2, doc2), ...] --> the
elements of the list are all tuples to add docstrings to many attributes
of an object.
is a place where docstrings can be added.
More information about the Numpy-discussion