Skip to content

Instantly share code, notes, and snippets.

@inky
Created March 21, 2009 04:00
Show Gist options
  • Save inky/82719 to your computer and use it in GitHub Desktop.
Save inky/82719 to your computer and use it in GitHub Desktop.
class Something:
#
# ...
# class definition
# ...
#
@property
def sort_value(self):
return self.some_important_variable
def __lt__(self, other):
return self.sort_value < other.sort_value
def __le__(self, other):
return self.sort_value <= other.sort_value
def __eq__(self, other):
return self.sort_value == other.sort_value
def __ne__(self, other):
return self.sort_value <> other.sort_value
def __gt__(self, other):
return self.sort_value > other.sort_value
def __ge__(self, other):
return self.sort_value >= other.sort_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment