Add __str__ for Distance.

This commit is contained in:
Dan Albert 2023-08-07 23:24:40 -07:00 committed by Raffson
parent fa1caa86d6
commit bf879a6141
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -201,6 +201,9 @@ class Distance:
def inf(cls) -> Distance:
return cls.from_meters(math.inf)
def __str__(self) -> str:
return f"{self.distance_in_meters} meters"
def __add__(self, other: Distance) -> Distance:
return meters(self.meters + other.meters)