comparison babel/messages/catalog.py @ 564:1ef087352e01 trunk

add more comparison methods to babel.messages.Catalog to ease the Python 3 transition
author fschwarz
date Sun, 25 Sep 2011 20:44:10 +0000
parents e8155a73ac2e
children b0e80df660ab
comparison
equal deleted inserted replaced
563:c6bc419cc32a 564:1ef087352e01
97 elif plural: 97 elif plural:
98 return cmp(self.id[0], obj.id) 98 return cmp(self.id[0], obj.id)
99 elif obj_plural: 99 elif obj_plural:
100 return cmp(self.id, obj.id[0]) 100 return cmp(self.id, obj.id[0])
101 return cmp(self.id, obj.id) 101 return cmp(self.id, obj.id)
102
103 def __gt__(self, other):
104 return self.__cmp__(other) > 0
105
106 def __lt__(self, other):
107 return self.__cmp__(other) < 0
108
109 def __ge__(self, other):
110 return self.__cmp__(other) >= 0
111
112 def __le__(self, other):
113 return self.__cmp__(other) <= 0
114
115 def __eq__(self, other):
116 return self.__cmp__(other) == 0
117
118 def __ne__(self, other):
119 return self.__cmp__(other) != 0
102 120
103 def clone(self): 121 def clone(self):
104 return Message(*map(copy, (self.id, self.string, self.locations, 122 return Message(*map(copy, (self.id, self.string, self.locations,
105 self.flags, self.auto_comments, 123 self.flags, self.auto_comments,
106 self.user_comments, self.previous_id, 124 self.user_comments, self.previous_id,
Copyright (C) 2012-2017 Edgewall Software