]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add __next__(), next() to ResultProxy
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Sep 2017 15:14:36 +0000 (11:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Sep 2017 18:03:27 +0000 (14:03 -0400)
commit339416b821ed543f289fccff8f6fc9c44dbc9d23
tree694b8be639abeb14c89e8101b3d8d1c2670c6abf
parent31f80b9eaeb3c3435b7f6679b41e434478b1d11c
Add __next__(), next() to ResultProxy

Added ``__next__()`` and ``next()`` methods to :class:`.ResultProxy`,
so that the ``next()`` builtin function works on the object directly.
:class:`.ResultProxy` has long had an ``__iter__()`` method which already
allows it to respond to the ``iter()`` builtin.   The implementation
for ``__iter__()`` is unchanged, as performance testing has indicated
that iteration using a ``__next__()`` method with ``StopIteration``
is about 20% slower in both Python 2.7 and 3.6.

Change-Id: I70569a4c48ad85a3c21a7ad422f270a559926cfb
Fixes: #4077
doc/build/changelog/unreleased_12/4077.rst [new file with mode: 0644]
lib/sqlalchemy/engine/result.py
test/sql/test_resultset.py