From: Menno Smits Date: Mon, 21 May 2012 21:25:05 +0000 (+0100) Subject: Make PushableIterator Python 2 & 3 compatible X-Git-Tag: 0.10~2^2~21^2~39 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=005a89855a686de4229b1d68a6604a74775e2a62;p=imapclient.git Make PushableIterator Python 2 & 3 compatible --- diff --git a/imapclient/response_lexer.py b/imapclient/response_lexer.py index 75ec475..07d4fce 100644 --- a/imapclient/response_lexer.py +++ b/imapclient/response_lexer.py @@ -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)