NEW: Coordinate().__mod__()
This commit is contained in:
parent
fb3bef0153
commit
14d535911c
@ -290,6 +290,12 @@ class Coordinate(tuple):
|
|||||||
else:
|
else:
|
||||||
return self.__class__(self[0] * other, self[1] * other, self[2] * other)
|
return self.__class__(self[0] * other, self[1] * other, self[2] * other)
|
||||||
|
|
||||||
|
def __mod__(self, other: int) -> Coordinate:
|
||||||
|
if self[2] is None:
|
||||||
|
return self.__class__(self[0] % other, self[1] % other)
|
||||||
|
else:
|
||||||
|
return self.__class__(self[0] % other, self[1] % other, self[2] % other)
|
||||||
|
|
||||||
def __floordiv__(self, other: int | float) -> Coordinate:
|
def __floordiv__(self, other: int | float) -> Coordinate:
|
||||||
if self[2] is None:
|
if self[2] is None:
|
||||||
return self.__class__(self[0] // other, self[1] // other)
|
return self.__class__(self[0] // other, self[1] // other)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user