]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Make PushableIterator Python 2 & 3 compatible
authorMenno Smits <menno@freshfoo.com>
Mon, 21 May 2012 21:25:05 +0000 (22:25 +0100)
committerMenno Smits <menno@freshfoo.com>
Mon, 21 May 2012 21:25:05 +0000 (22:25 +0100)
imapclient/response_lexer.py

index 75ec475d0969164e52e7c396f9120d6fb5f8de44..07d4fce4b3114f59d4e0034f03671e757b18b3ce 100644 (file)
@@ -154,11 +154,14 @@ class PushableIterator(object):
     def __iter__(self):
         return self
 
-    def next(self):
+    def __next__(self):
         if self.pushed:
             return self.pushed.pop()
         return advance_iterator(self.it)
 
+    # For Python 2 compatibility
+    next = __next__
+
     def push(self, item):
         self.pushed.append(item)