From 5f6e6c81c9207f6e666f933b1ae952d9983bc27e Mon Sep 17 00:00:00 2001 From: Sergey G Date: Thu, 13 Apr 2017 21:01:19 +0500 Subject: [PATCH] close #187 --- trello/label.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/trello/label.py b/trello/label.py index b499620d..374d8571 100644 --- a/trello/label.py +++ b/trello/label.py @@ -40,3 +40,12 @@ def fetch(self): self.name = json_obj['name'] self.color = json_obj['color'] return self + + def __hash__(self): + class_name = type(self).__name__ + return hash(class_name) ^ hash(self.id) + + def __eq__(self, other): + if isinstance(other, type(self)): + return hash(self) == hash(other) + raise NotImplementedError