Make Label() object hashable
Since it got custom __eq__ function, __hash__ needs to be implemented too. Otherwise it can't be used as a key in dict.
This commit is contained in:
parent
60d28dc13a
commit
a078e1f617
@ -80,3 +80,6 @@ class Label(object):
|
|||||||
if isinstance(other, Label):
|
if isinstance(other, Label):
|
||||||
return self.name == other.name
|
return self.name == other.name
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user