diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-03-26 00:08:17 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-28 20:44:34 +0100 |
commit | 7bf911585d7f9d56480ee1b3d70fab39fc588350 (patch) | |
tree | 13204d10dba18e2437396c9022161c88020f8ddd /numpy/add_newdocs.py | |
parent | ee8ce2438e8a089a06d2c8e99518df8f638afb29 (diff) | |
download | numpy-7bf911585d7f9d56480ee1b3d70fab39fc588350.tar.gz |
ENH: Allow AxisErrors to have a prefix on the message
Moving the string formatting to python makes this a lot easier
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 40b38e01a..ca735cbc2 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -6739,7 +6739,7 @@ add_newdoc('numpy.core.multiarray', 'busday_count', add_newdoc('numpy.core.multiarray', 'normalize_axis_index', """ - normalize_axis_index(axis, ndim) + normalize_axis_index(axis, ndim, msg_prefix=None) Normalizes an axis index, `axis`, such that is a valid positive index into the shape of array with `ndim` dimensions. Raises an AxisError with an @@ -6756,6 +6756,8 @@ add_newdoc('numpy.core.multiarray', 'normalize_axis_index', ndim : int The number of dimensions of the array that `axis` should be normalized against + msg_prefix : str + A prefix to put before the message, typically the name of the argument Returns ------- @@ -6780,6 +6782,10 @@ add_newdoc('numpy.core.multiarray', 'normalize_axis_index', Traceback (most recent call last): ... AxisError: axis 3 is out of bounds for array of dimension 3 + >>> normalize_axis_index(-4, ndim=3, msg_prefix='axes_arg') + Traceback (most recent call last): + ... + AxisError: axes_arg: axis -4 is out of bounds for array of dimension 3 """) ############################################################################## |