diff --git a/src/compas/geometry/vector.py b/src/compas/geometry/vector.py index d52566b7293..7ccf054431f 100644 --- a/src/compas/geometry/vector.py +++ b/src/compas/geometry/vector.py @@ -151,22 +151,22 @@ def __sub__(self, other): def __mul__(self, other): if isinstance(other, (int, float)): return Vector(self.x * other, self.y * other, self.z * other) - else: - try: - other = Vector(*other) - return Vector(self.x * other.x, self.y * other.y, self.z * other.z) - except TypeError: - raise TypeError("Cannot cast {} {} to Vector".format(other, type(other))) + + try: + other = Vector(*other) + return Vector(self.x * other.x, self.y * other.y, self.z * other.z) + except TypeError: + raise TypeError("Cannot cast {} {} to Vector".format(other, type(other))) def __truediv__(self, other): if isinstance(other, (int, float)): return Vector(self.x / other, self.y / other, self.z / other) - else: - try: - other = Vector(*other) - return Vector(self.x / other.x, self.y / other.y, self.z / other.z) - except TypeError: - raise TypeError("Cannot cast {} {} to Vector".format(other, type(other))) + + try: + other = Vector(*other) + return Vector(self.x / other.x, self.y / other.y, self.z / other.z) + except TypeError: + raise TypeError("Cannot cast {} {} to Vector".format(other, type(other))) def __pow__(self, n): return Vector(self.x**n, self.y**n, self.z**n)