summaryrefslogtreecommitdiff
path: root/numpy/lib/arrayterator.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/arrayterator.py')
-rw-r--r--numpy/lib/arrayterator.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py
index 8ac720ccd..d9839feeb 100644
--- a/numpy/lib/arrayterator.py
+++ b/numpy/lib/arrayterator.py
@@ -104,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:
@@ -180,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[:]
@@ -199,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]