From fedd7382ffdc44e11616c1355e0fa99c4a7429f7 Mon Sep 17 00:00:00 2001 From: Ryan Rubin Date: Mon, 14 Nov 2016 13:26:19 -0600 Subject: [PATCH] add __gt__ method, because functools.total_ordering is not properly converting the lt comparison to a gt comparison --- duo.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/duo.py b/duo.py index 4f360e4..7c25d30 100644 --- a/duo.py +++ b/duo.py @@ -148,6 +148,12 @@ def __lt__(self, other): else: return int(self) < int(other) + def __gt__(self, other): + if isinstance(other, string_types): + return str(self) > other + else: + return int(self) > int(other) + def __eq__(self, other): if isinstance(other, string_types): return str(self) == other