def __mul__(self, other):
"""Producto punto o producto por valor"""
if isinstance(other, Vector3):
return Vector3(self.x * other.get_x(), self.y * other.get_y(), self.z * other.get_z())
else:
if isinstance(other, types.ListType) or isinstance(other, types.TupleType):
return Vector3(self.x * other[0], self.y * other[1], self.z * other[2])
elif isinstance(other, types.IntType) or isinstance(other, types.FloatType):
return Vector3(self.x * other, self.y * other, self.z * other)
else:
self.throwError(2, "__mul__")
return self
评论列表
文章目录