diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 19:53:30 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-01 19:57:37 -0800 |
commit | f5703dc3e55008b03aad4db8d8f3c5fa12dbae86 (patch) | |
tree | afbb7a1f165ddf529fc95376397dfa02bee383c8 /lib/extras.py | |
parent | a51160317c680662c52e4a1a6b4d11beae37f205 (diff) | |
download | psycopg2-f5703dc3e55008b03aad4db8d8f3c5fa12dbae86.tar.gz |
Use builtin function next() throughout project
Available since Python 2.6. Use of .next() is deprecated and not
supported in Python 3. Forward compatible with modern Python.
https://docs.python.org/2/library/functions.html#next
Diffstat (limited to 'lib/extras.py')
-rw-r--r-- | lib/extras.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/extras.py b/lib/extras.py index 3308f78..a6c025e 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -110,16 +110,16 @@ class DictCursorBase(_cursor): try: if self._prefetch: res = super(DictCursorBase, self).__iter__() - first = res.next() + first = next(res) if self._query_executed: self._build_index() if not self._prefetch: res = super(DictCursorBase, self).__iter__() - first = res.next() + first = next(res) yield first while 1: - yield res.next() + yield next(res) except StopIteration: return @@ -349,7 +349,7 @@ class NamedTupleCursor(_cursor): def __iter__(self): try: it = super(NamedTupleCursor, self).__iter__() - t = it.next() + t = next(it) nt = self.Record if nt is None: @@ -358,7 +358,7 @@ class NamedTupleCursor(_cursor): yield nt._make(t) while 1: - yield nt._make(it.next()) + yield nt._make(next(it)) except StopIteration: return @@ -1144,7 +1144,7 @@ def _paginate(seq, page_size): while 1: try: for i in xrange(page_size): - page.append(it.next()) + page.append(next(it)) yield page page = [] except StopIteration: |