From 54f9fc5c60976abb34e3dae6a9eae902fcf61dfc Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 8 Jul 2019 23:30:31 -0700 Subject: DOC: Add a numpy-doc docstring to add_newdoc --- numpy/core/function_base.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'numpy/core/function_base.py') 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. -- cgit v1.2.1