Skip to content

Commit

Permalink
add __gt__ method, because functools.total_ordering is not properly c…
Browse files Browse the repository at this point in the history
…onverting the lt comparison to a gt comparison
  • Loading branch information
ryanmrubin committed Nov 14, 2016
1 parent 6ef3bf9 commit fedd738
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions duo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fedd738

Please sign in to comment.