summaryrefslogtreecommitdiff
path: root/numpy/lib/arrayterator.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-07-31 14:30:10 -0600
committerCharles Harris <charlesr.harris@gmail.com>2014-07-31 14:30:10 -0600
commitae7c942ced535fb39384aefeb8d32df92fb15988 (patch)
treed06ae19daed6c32522e3a06fb27afb4490302d0d /numpy/lib/arrayterator.py
parent2ad538899928c249af456d93f250ebbd7535dcff (diff)
parent01b0d7e82211b581aaff925e3ccc36cff9ac1895 (diff)
downloadnumpy-ae7c942ced535fb39384aefeb8d32df92fb15988.tar.gz
Merge pull request #4929 from juliantaylor/charris-pep8-numpy-lib
Charris pep8 numpy lib
Diffstat (limited to 'numpy/lib/arrayterator.py')
-rw-r--r--numpy/lib/arrayterator.py14
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]