I have a class that accepts either ints or floats in it's init but all must be int or float so i am using typing.overload to achieve that and I want to be able to type hint the return of a function based on the given values.
class Vector3: @overload def __init__(self, x: int, y: int, z: int) -> None: ... @overload def __init__(self, x: float, y: float, z: float) -> None: ... def __init__(self, x, y, z) -> None: self._x = x self._y = y self._z = z # This function def __key(self) -> tuple[int | float, int | float, int | float]: return (self._x, self._y, self._z)Also how would I type hint the values of x, y, and z? I plan to use @property to obfuscate the _x, _y, _z values and don't know how I'd type hint them either.
@propertydef x(self) -> int | float: return self._x