mypy is really handy and catches a lot of bugs, but when I write \"scientific\" applications, I often end up doing:
def my_func(number: Union[float, int]): #
You can define your own type to address this and keep your code cleaner.
FloatInt = Union[float, int] def my_func(number: FloatInt): # Do something