adjusted Attr equality

This commit is contained in:
Sakimori 2024-08-14 11:51:41 -04:00
parent 37962bbb61
commit eb9e371a5a

View file

@ -30,11 +30,13 @@ class Attribute:
return f"{self.name} - {int(self.value)}"
#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):
return self.name == other.name
return self.value == other.value
elif isinstance(other, int):
return self.value == other
elif isinstance(other, str):
return self.name == other
else:
return False