summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-19 19:29:18 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-19 19:29:18 -0500
commit02f21ffcf366da406795334d2fc6908a2f3c9b2f (patch)
treef3f92d882667d7133f9e623335134dd4dc59a5b0 /lib/sqlalchemy/engine
parent63508b82cd5710c660383bcac5fcfd3bb6af83c1 (diff)
downloadsqlalchemy-02f21ffcf366da406795334d2fc6908a2f3c9b2f.tar.gz
- The :class:`.RowProxy` object is now sortable in Python as a regular
tuple is; this is accomplished via ensuring tuple() conversion on both sides within the ``__eq__()`` method as well as the addition of a ``__lt__()`` method. [ticket:2848]
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/result.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py
index 0e2316573..93c7d3b6b 100644
--- a/lib/sqlalchemy/engine/result.py
+++ b/lib/sqlalchemy/engine/result.py
@@ -125,8 +125,11 @@ class RowProxy(BaseRowProxy):
__hash__ = None
+ def __lt__(self, other):
+ return tuple(self) < tuple(other)
+
def __eq__(self, other):
- return other is self or other == tuple(self)
+ return other is self or tuple(other) == tuple(self)
def __ne__(self, other):
return not self.__eq__(other)