ch01-12: clean up by @eumiro

This commit is contained in:
Luciano Ramalho
2021-02-14 20:28:07 -03:00
parent 584a7f21ca
commit 03ace4f4ae
33 changed files with 1383 additions and 86 deletions

View File

@@ -29,7 +29,7 @@ Scalar multiplication::
"""
from math import hypot
import math
class Vector:
@@ -41,7 +41,7 @@ class Vector:
return f'Vector({self.x!r}, {self.y!r})'
def __abs__(self):
return hypot(self.x, self.y)
return math.hypot(self.x, self.y)
def __bool__(self):
return bool(abs(self))