diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-07-08 23:30:31 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-07-08 23:30:31 -0700 |
commit | 54f9fc5c60976abb34e3dae6a9eae902fcf61dfc (patch) | |
tree | deb838fc039640d2048eb4ba5b4182dc0631585a /numpy/core/function_base.py | |
parent | b592e8f34ef750579b752c590338b3f7cbe92939 (diff) | |
download | numpy-54f9fc5c60976abb34e3dae6a9eae902fcf61dfc.tar.gz |
DOC: Add a numpy-doc docstring to add_newdoc
Diffstat (limited to 'numpy/core/function_base.py')
-rw-r--r-- | numpy/core/function_base.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index a7700bb73..aee78d734 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -437,18 +437,29 @@ def _add_docstring(obj, doc): def add_newdoc(place, obj, doc): """ - Adds documentation to obj which is in module place. + Add documentation to an existing object, typically one defined in C - If doc is a string add it to obj as a docstring + The purpose is to allow easier editing of the docstrings without requiring + a re-compile. This exists primarily for internal use within numpy itself. - If doc is a tuple, then the first element is interpreted as - an attribute of obj and the second as the docstring - (method, docstring) + Parameters + ---------- + place : str + The absolute name of the module to import from + obj : str + The name of the object to add documentation to, typically a class or + function name + doc : {str, Tuple[str, str], List[Tuple[str, str]]} + If a string, the documentation to apply to `obj` + + If a tuple, then the first element is interpreted as an attribute of + `obj` and the second as the docstring to apply - ``(method, docstring)`` - If doc is a list, then each element of the list should be a - sequence of length two --> [(method1, docstring1), - (method2, docstring2), ...] + If a list, then each element of the list should be a tuple of length + two - ``[(method1, docstring1), (method2, docstring2), ...]`` + Notes + ----- This routine never raises an error if the docstring can't be written, but will raise an error if the object being documented does not exist. |