+ def __sub__(self, other):
+ """
+ If other is a point, substract it from the vector self and return the
+ resulting point. If other is a vector, return the vector self - other.
+ """
+ if isinstance(other, (Point, Vector)):
+ coordinates = self._map2(other, operator.sub)
+ return other.__class__(coordinates)
+ return NotImplemented
+
+ def __neg__(self):
+ """
+ Return the vector -self.
+ """
+ coordinates = self._map(operator.neg)
+ return Vector(coordinates)
+
+ def __mul__(self, other):
+ """
+ Multiplies a Vector by a scalar value.
+ """
+ if isinstance(other, numbers.Real):
+ coordinates = self._map(lambda coordinate: other * coordinate)
+ return Vector(coordinates)
+ return NotImplemented
+
+ __rmul__ = __mul__
+
+ def __truediv__(self, other):
+ """
+ Divide the vector by the specified scalar and returns the result as a
+ vector.
+ """
+ if isinstance(other, numbers.Real):
+ coordinates = self._map(lambda coordinate: coordinate / other)
+ return Vector(coordinates)
+ return NotImplemented
+