Skip to content

Commit 10c13dd

Browse files
committed
Further __eq__ optimization
1 parent ebfbbd6 commit 10c13dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gemd/entity/base_entity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ def __eq__(self, other):
209209
from gemd.entity.link_by_uid import LinkByUID
210210
from gemd.util import cached_isinstance
211211

212-
if cached_isinstance(other, LinkByUID):
212+
if id(self) == id(other):
213+
return True
214+
elif cached_isinstance(other, LinkByUID):
213215
return self.uids.get(other.scope) == other.id
214216
elif cached_isinstance(other, tuple):
215217
return len(other) == 2 and other[0] in self.uids and self.uids[other[0]] == other[1]

0 commit comments

Comments
 (0)