Skip to content

Commit

Permalink
Type annotation is not changed. __iadd__ updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonralex authored Nov 7, 2023
1 parent 91d621c commit dc353e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def __add__(self, other: T | int | float) -> T:
def __iadd__(self, other: T | int | float) -> T:
if isinstance(other, Distance):
self.km += other.km
return self
if isinstance(other, (int, float)):
self.km += other
return self
raise TypeError("Unsupported operand types")
if not isinstance(other, (Distance, int, float)):
raise TypeError("Unsupported operand types")
return self

def __mul__(self, other: int | float) -> T:
if isinstance(other, (int, float)):
Expand Down

0 comments on commit dc353e7

Please sign in to comment.