diff options
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index d26d9ded8..04010ec3c 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1186,14 +1186,12 @@ def roll(a, shift, axis=None): reshape = False if n == 0: return a - else: - shift %= n - indexes = concatenate((arange(n-shift,n),arange(n-shift))) - res = a.take(indexes, axis) - if reshape: - return res.reshape(a.shape) - else: - return res + shift %= n + indexes = concatenate((arange(n - shift, n), arange(n - shift))) + res = a.take(indexes, axis) + if reshape: + res = res.reshape(a.shape) + return res def rollaxis(a, axis, start=0): """ |