We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c53d2d0 commit c40bf7cCopy full SHA for c40bf7c
linear_algebra/src/lib.py
@@ -187,9 +187,11 @@ def __eq__(self, vector: Vector) -> bool:
187
"""
188
performs the comparison between two vectors
189
190
- if len(self) != len(vector):
+ if not isinstance(other, Vector):
191
+ return NotImplemented
192
+ if len(self) != len(other):
193
return False
- 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)))
195
196
197
def zero_vector(dimension: int) -> Vector:
0 commit comments