diff options
Diffstat (limited to 'numpy/lib/arrayterator.py')
-rw-r--r-- | numpy/lib/arrayterator.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py index c2cde574e..d9839feeb 100644 --- a/numpy/lib/arrayterator.py +++ b/numpy/lib/arrayterator.py @@ -9,7 +9,6 @@ a user-specified number of elements. """ from __future__ import division, absolute_import, print_function -import sys from operator import mul from functools import reduce @@ -105,7 +104,8 @@ class Arrayterator(object): """ # Fix index, handling ellipsis and incomplete slices. - if not isinstance(index, tuple): index = (index,) + if not isinstance(index, tuple): + index = (index,) fixed = [] length, dims = len(index), len(self.shape) for slice_ in index: @@ -181,7 +181,8 @@ class Arrayterator(object): def __iter__(self): # Skip arrays with degenerate dimensions - if [dim for dim in self.shape if dim <= 0]: raise StopIteration + if [dim for dim in self.shape if dim <= 0]: + raise StopIteration start = self.start[:] stop = self.stop[:] @@ -200,12 +201,13 @@ class Arrayterator(object): # along higher dimensions, so we read only a single position if count == 0: stop[i] = start[i]+1 - elif count <= self.shape[i]: # limit along this dimension + elif count <= self.shape[i]: + # limit along this dimension stop[i] = start[i] + count*step[i] rundim = i else: - stop[i] = self.stop[i] # read everything along this - # dimension + # read everything along this dimension + stop[i] = self.stop[i] stop[i] = min(self.stop[i], stop[i]) count = count//self.shape[i] |