summaryrefslogtreecommitdiff
path: root/numpy/_globals.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2021-01-29 07:49:22 +0100
committerRalf Gommers <ralf.gommers@gmail.com>2021-01-29 07:49:22 +0100
commit4c4f201e3d16b57e1ba03a5c12ed6343cca447ae (patch)
tree8e015fadd9397fd81523775d335c4d6972f2ee16 /numpy/_globals.py
parent7a4e602a1f9e39ec3662e21a12c35c6df0cf9295 (diff)
downloadnumpy-4c4f201e3d16b57e1ba03a5c12ed6343cca447ae.tar.gz
DOC: improve description of `NoValue`.
[ci skip]
Diffstat (limited to 'numpy/_globals.py')
-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):