Skip to content

Commit

Permalink
remove else
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jun 7, 2024
1 parent 2cae390 commit 70acd71
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/compas/geometry/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 70acd71

Please sign in to comment.