provide __next__() and use native next() to support py2/py3 in one source. refs #1350.

This commit is contained in:
Takayuki Shimizukawa
2014-04-29 21:54:25 +09:00
parent 49944cfa52
commit 91b9d75ac8
8 changed files with 33 additions and 29 deletions

View File

@@ -1187,7 +1187,7 @@ class _IterParseIterator(object):
append((event, None))
parser.EndNamespaceDeclHandler = handler
def next(self):
def __next__(self):
while 1:
try:
item = self._events[self._index]
@@ -1208,6 +1208,8 @@ class _IterParseIterator(object):
self._index = self._index + 1
return item
next = __next__ # Python 2 compatibility
def __iter__(self):
return self