From fa369d17e110717535860d8caea5bec44da53f42 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sun, 11 Sep 2016 01:02:19 -0400 Subject: DOC, MAINT: Update error message in rollaxis. Updates error message to properly reflect that the 'start' or 'axis' can be negative. Closes gh-7974. --- numpy/core/numeric.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index ad2dcc291..81d9d3697 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1531,12 +1531,12 @@ def rollaxis(a, axis, start=0): axis += n if start < 0: start += n - msg = 'rollaxis: %s (%d) must be >=0 and < %d' + msg = "'%s' arg requires %d <= %s < %d, but %d was passed in" if not (0 <= axis < n): - raise ValueError(msg % ('axis', axis, n)) + raise ValueError(msg % ('axis', -n, 'axis', n, axis)) if not (0 <= start < n + 1): - raise ValueError(msg % ('start', start, n + 1)) - if (axis < start): + raise ValueError(msg % ('start', -n, 'start', n + 1, start)) + if axis < start: # it's been removed start -= 1 if axis == start: -- cgit v1.2.1