add GPC.__eq__() and .__ne__()
This commit is contained in:
parent
c1987780b2
commit
92abd79a97
|
@ -63,6 +63,18 @@ class GPC(object):
|
|||
value += str(barcodes.upc_check_digit(value))
|
||||
self.value = int(value)
|
||||
|
||||
def __eq__(self, other):
|
||||
try:
|
||||
return int(self) == int(other)
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
try:
|
||||
return int(self) != int(other)
|
||||
except (TypeError, ValueError):
|
||||
return True
|
||||
|
||||
def __cmp__(self, other):
|
||||
if int(self) < int(other):
|
||||
return -1
|
||||
|
|
Loading…
Reference in a new issue