(self, other)
| 249 | def __add__(self, other): |
| 250 | return Vec2D(self[0]+other[0], self[1]+other[1]) |
| 251 | def __mul__(self, other): |
| 252 | if isinstance(other, Vec2D): |
| 253 | return self[0]*other[0]+self[1]*other[1] |
| 254 | return Vec2D(self[0]*other, self[1]*other) |
| 255 | def __rmul__(self, other): |
| 256 | if isinstance(other, int) or isinstance(other, float): |
| 257 | return Vec2D(self[0]*other, self[1]*other) |