Skip to content

Commit c40bf7c

Browse files
authored
Update lib.py
1 parent c53d2d0 commit c40bf7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

linear_algebra/src/lib.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ def __eq__(self, vector: Vector) -> bool:
187187
"""
188188
performs the comparison between two vectors
189189
"""
190-
if len(self) != len(vector):
190+
if not isinstance(other, Vector):
191+
return NotImplemented
192+
if len(self) != len(other):
191193
return False
192-
return all(self.component(i) == vector.component(i) for i in range(len(self)))
194+
return all(self.component(i) == other.component(i) for i in range(len(self)))
193195

194196

195197
def zero_vector(dimension: int) -> Vector:

0 commit comments

Comments
 (0)