diff -r d1e6a48dfb0d Lib/uuid.py --- a/Lib/uuid.py Sun Jan 20 01:31:20 2013 +0100 +++ b/Lib/uuid.py Sun Jan 20 09:21:24 2013 +0530 @@ -53,6 +53,7 @@ int_ = int # The built-in int type bytes_ = bytes # The built-in bytes type +@functools.total_ordering class UUID(object): """Instances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. @@ -187,11 +188,6 @@ return self.int == other.int return NotImplemented - def __ne__(self, other): - if isinstance(other, UUID): - return self.int != other.int - return NotImplemented - # Q. What's the value of being able to sort UUIDs? # A. Use them as keys in a B-Tree or similar mapping. @@ -200,21 +196,6 @@ return self.int < other.int return NotImplemented - def __gt__(self, other): - if isinstance(other, UUID): - return self.int > other.int - return NotImplemented - - def __le__(self, other): - if isinstance(other, UUID): - return self.int <= other.int - return NotImplemented - - def __ge__(self, other): - if isinstance(other, UUID): - return self.int >= other.int - return NotImplemented - def __hash__(self): return hash(self.int)