Skip to content

Commit 479ca3a

Browse files
committed
Simplify comparison code.
1 parent 68f8096 commit 479ca3a

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

sc2reader/data/__init__.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -276,31 +276,14 @@ def __str__(self):
276276
return "{0} [{1:X}]".format(self.name, self.id)
277277

278278
def __cmp__(self, other):
279-
if self._cmp_val == other._cmp_val:
280-
return 0
281-
elif self._cmp_val > other._cmp_val:
282-
return 1
283-
else:
284-
return -1
279+
return cmp(self._cmp_val, other._cmp_val)
285280

286281
def __hash__(self):
287282
return hash(self._cmp_val)
288283

289284
def __repr__(self):
290285
return str(self)
291286

292-
def __cmp__(self, other):
293-
if other.id > self.id:
294-
return -1
295-
elif other.id < self.id:
296-
return 1
297-
else:
298-
if other.type > self.type:
299-
return -1
300-
elif other.type < self.type:
301-
return 1
302-
else:
303-
return 0
304287

305288
class Ability(object):
306289
pass

0 commit comments

Comments
 (0)