Skip to content

Commit

Permalink
Fixed iterator in Python 3
Browse files Browse the repository at this point in the history
This fixes iteration over linearsequence and scaledarray objects in Python 3.

One test in test_axographio.py is still failing in Python 3 (but not Python 2).
  • Loading branch information
jpgill86 committed May 30, 2018
1 parent 77e0ed3 commit 23f1a52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion axographio.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@ class _getitem_iterator:
def __iter__(self):
return self

def next(self):
def __next__(self):
if self.index >= len(self.array):
raise StopIteration()
self.index += 1
return self.array[self.index - 1]

next = __next__ # for Python 2



class linearsequence:
Expand Down

0 comments on commit 23f1a52

Please sign in to comment.