We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c1462ba + 425a5de commit b44074cCopy full SHA for b44074c
vpython/cyvector.pyx
@@ -85,6 +85,12 @@ cdef class vector(object):
85
return vector(self * other._x, self * other._y, self * other._z)
86
return NotImplemented
87
88
+ def __rmul__(self, other): # required to prevent y * x error
89
+ if isinstance(other, (float, int)):
90
+ return vector(self._x * other, self._y * other, self._z * other)
91
+
92
+ return NotImplemented
93
94
def __eq__(self,other):
95
if type(self) is vector and type(other) is vector:
96
return self.equals(other)
0 commit comments