This looks pretty good. We should have type checking on other in the __add__ method and a few more docstrings would be good. Beyond that there are some design issues to consider, but they may not need to be part of this PR.
This looks pretty good. We should have type checking on `other` in the `__add__` method and a few more docstrings would be good. Beyond that there are some design issues to consider, but they may not need to be part of this PR.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This looks pretty good. We should have type checking on
otherin the__add__method and a few more docstrings would be good. Beyond that there are some design issues to consider, but they may not need to be part of this PR.@@ -30,6 +30,20 @@ class Vector(object):s = "Vector(x=%s, y=%s, z=%s)" % (self.x, self.y, self.z)return sdef __add__(self, other):This should handle case where
otheris not aVector.@@ -33,0 +37,4 @@return self.__class__(x, y, z)def __mul__(self, other):if not isinstance(other, Vector):Do we want to handle scalar multiplication here? If so we should implement
__rmul__and__imul__.@@ -0,0 +53,4 @@def test_dot_product(self):v1 = Vector(1, 2, 3)v2 = Vector(-3, -2, -1)v3 = v1.dot(v2)Seeing this in use, perhaps we should use
@for dot product? So we getv1 @ v2. Can we open an issue to discuss this?The operation for cross product using '*' would confuse users who want to multiply vectors.