adjusted Attr equality
This commit is contained in:
parent
37962bbb61
commit
eb9e371a5a
|
@ -30,11 +30,13 @@ class Attribute:
|
||||||
return f"{self.name} - {int(self.value)}"
|
return f"{self.name} - {int(self.value)}"
|
||||||
|
|
||||||
#Comparison helpers
|
#Comparison helpers
|
||||||
def __eq__(self, other): #can compare attributes by name, or find attribute by value
|
def __eq__(self, other): #can compare attributes by value, or find attribute by name
|
||||||
if isinstance(other, Attribute):
|
if isinstance(other, Attribute):
|
||||||
return self.name == other.name
|
return self.value == other.value
|
||||||
elif isinstance(other, int):
|
elif isinstance(other, int):
|
||||||
return self.value == other
|
return self.value == other
|
||||||
|
elif isinstance(other, str):
|
||||||
|
return self.name == other
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue