The current Implementation of vectors raises an exception in __mul__ when you try to operate on a non-vector type.
This can be quite annoying, because even if for example Quaternion implements __rmul__ it will never be called when the vector is on the left side of the equation and instead error out.
Furthermore: https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types specifies that (some) operators should return NotImplemented.
# Does not work, should work
v = vector(0, 0, 0) * quaternion(0, 0, 0, 0)
# Does work, should work
v = quaternion(0,0,0,0) * vector(0,0,0,0)
Both the python and cython implementations have been tested (existing physics project that makes heavy use of vectors didn't break)
The current Implementation of vectors raises an exception in
__mul__
when you try to operate on a non-vector type. This can be quite annoying, because even if for exampleQuaternion
implements__rmul__
it will never be called when the vector is on the left side of the equation and instead error out. Furthermore: https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types specifies that (some) operators should returnNotImplemented
.Both the python and cython implementations have been tested (existing physics project that makes heavy use of vectors didn't break)