summaryrefslogtreecommitdiff
path: root/numpy/lib/arrayterator.py
diff options
context:
space:
mode:
authorNathaniel J. Smith <njs@pobox.com>2015-06-24 18:32:07 -0700
committerNathaniel J. Smith <njs@pobox.com>2015-06-24 18:32:07 -0700
commite552922fe6c8854541337a10970ff1b62caffc70 (patch)
treef2de1f207bfc50015a3b10f075bda1604caaa8e3 /numpy/lib/arrayterator.py
parent75190503dd569e58029cdac81e6451907181c130 (diff)
downloadnumpy-e552922fe6c8854541337a10970ff1b62caffc70.tar.gz
MAINT: remove use of 'raise StopIteration' from generators
This triggers a PendingDeprecationWarning in py3.5 -- you're supposed to just write "return" instead (which on earlier versions is equivalent). See PEP 479: https://www.python.org/dev/peps/pep-0479/
Diffstat (limited to 'numpy/lib/arrayterator.py')
-rw-r--r--numpy/lib/arrayterator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py
index d9839feeb..4aa977c46 100644
--- a/numpy/lib/arrayterator.py
+++ b/numpy/lib/arrayterator.py
@@ -182,7 +182,7 @@ class Arrayterator(object):
def __iter__(self):
# Skip arrays with degenerate dimensions
if [dim for dim in self.shape if dim <= 0]:
- raise StopIteration
+ return
start = self.start[:]
stop = self.stop[:]
@@ -223,4 +223,4 @@ class Arrayterator(object):
start[i] = self.start[i]
start[i-1] += self.step[i-1]
if start[0] >= self.stop[0]:
- raise StopIteration
+ return