Revision: 51235
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 18, 2011 20:55 by djbobyd
Initial Code
class RichComparisonMixin(object):
def __eq__(self, other):
raise NotImplementedError("Equality not implemented")
def __lt__(self, other):
raise NotImplementedError("Less than not implemented")
def __ne__(self, other):
return not self.__eq__(other)
def __gt__(self, other):
return not (self.__lt__(other) or self.__eq__(other))
def __le__(self, other):
return self.__eq__(other) or self.__lt__(other)
def __ge__(self, other):
return self.__eq__(other) or self.__gt__(other)
Initial URL
http://www.voidspace.org.uk/python/articles/comparison.shtml
Initial Description
Meta Class that can be used for simplifying rich comparison in Python
Initial Title
Rich Comparison Class
Initial Tags
Initial Language
Python