def __mul__(self, other):
"""Multiply a Point with a constant.
>>> 2 * Point(1,2)
(2.000,4.000)
>>> Point(1,2) * Point(1,2) #doctest:+IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
TypeError:
"""
if not isinstance(other, numbers.Real):
return NotImplemented
return Point(self.x * other, self.y * other)
评论列表
文章目录