diff options
author | Matthew Brett <matthew.brett@gmail.com> | 2015-03-15 11:31:37 -0700 |
---|---|---|
committer | Matthew Brett <matthew.brett@gmail.com> | 2015-03-15 11:31:37 -0700 |
commit | 4b4d8510739c9ea7a80391e2656d84a3c5e4a9c3 (patch) | |
tree | b294bdbe93b62889919080d31ad71bf7cc19f48c /numpy/__init__.py | |
parent | c60f1c6d944b25c5a001cf80e9b65dd5d44ed85d (diff) | |
download | numpy-4b4d8510739c9ea7a80391e2656d84a3c5e4a9c3.tar.gz |
ENH: _NoValue class at top-level to test kwargs
Add _NoValue class at top level to make it possible to detect when
non-default values got passed to a keyword argument, as in:
def func(a, b=np._NoValue):
if b is not np._NoValue:
warnings.warn("Argument b is deprecated",
DeprecationWarning)
Diffstat (limited to 'numpy/__init__.py')
-rw-r--r-- | numpy/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index 772c75b63..39933e8ca 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -132,6 +132,16 @@ class VisibleDeprecationWarning(UserWarning): pass +class _NoValue: + """Special keyword value. + + 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. + """ + pass + + # oldnumeric and numarray were removed in 1.9. In case some packages import # but do not use them, we define them here for backward compatibility. oldnumeric = 'removed' |