Skip to content

Commit e7d286c

Browse files
committed
improve FancyArray.__eq__
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 6b06c3e commit e7d286c

File tree

1 file changed

+4
-2
lines changed
  • src/power_grid_model_ds/_core/model/arrays/base

1 file changed

+4
-2
lines changed

src/power_grid_model_ds/_core/model/arrays/base/array.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ def __contains__(self: Self, item: Self) -> bool:
180180
def __hash__(self: Self):
181181
return hash(f"{self.__class__} {self}")
182182

183-
def __eq__(self: Self, other):
184-
return self._data.__eq__(other.data)
183+
def __eq__(self, other):
184+
if not isinstance(other, self.__class__):
185+
return False
186+
return self.data.__eq__(other.data)
185187

186188
def __copy__(self: Self):
187189
return self.__class__(data=copy(self._data))

0 commit comments

Comments
 (0)