From 02f21ffcf366da406795334d2fc6908a2f3c9b2f Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 19 Nov 2013 19:29:18 -0500 Subject: - 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] --- lib/sqlalchemy/engine/result.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/engine') 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) -- cgit v1.2.1