summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-01-29 09:41:40 +0200
committerGitHub <noreply@github.com>2021-01-29 09:41:40 +0200
commitb969f8c9a2178bec235d6c47db3e7cd68c5d39c1 (patch)
treea62e4f023f3e078e4e09584fb08bf74c7bd9ca0a
parentf42b5a01c8e82dee90d08fd470a16b2fe957fa14 (diff)
parent4c4f201e3d16b57e1ba03a5c12ed6343cca447ae (diff)
downloadnumpy-b969f8c9a2178bec235d6c47db3e7cd68c5d39c1.tar.gz
Merge pull request #18253 from rgommers/doc-novalue
DOC: improve description of `_NoValue`
-rw-r--r--numpy/_globals.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/_globals.py b/numpy/_globals.py
index 9f44c7729..4a8c266d3 100644
--- a/numpy/_globals.py
+++ b/numpy/_globals.py
@@ -58,8 +58,20 @@ class _NoValueType:
"""Special keyword value.
The instance of this class may be used as the default value assigned to a
- deprecated keyword in order to check if it has been given a user defined
- value.
+ keyword if no other obvious default (e.g., `None`) is suitable,
+
+ Common reasons for using this keyword are:
+
+ - A new keyword is added to a function, and that function forwards its
+ inputs to another function or method which can be defined outside of
+ NumPy. For example, ``np.std(x)`` calls ``x.std``, so when a ``keepdims``
+ keyword was added that could only be forwarded if the user explicitly
+ specified ``keepdims``; downstream array libraries may not have added
+ the same keyword, so adding ``x.std(..., keepdims=keepdims)``
+ unconditionally could have broken previously working code.
+ - A keyword is being deprecated, and a deprecation warning must only be
+ emitted when the keyword is used.
+
"""
__instance = None
def __new__(cls):