(self, other)
| 150 | def __add__(self, other): |
| 151 | return Vec2D(self[0]+other[0], self[1]+other[1]) |
| 152 | def __mul__(self, other): |
| 153 | if isinstance(other, Vec2D): |
| 154 | return self[0]*other[0]+self[1]*other[1] |
| 155 | return Vec2D(self[0]*other, self[1]*other) |
| 156 | def __rmul__(self, other): |
| 157 | if isinstance(other, int) or isinstance(other, float): |
| 158 | return Vec2D(self[0]*other, self[1]*other) |