I've read the issue, and it seems that it's more about the lack of overloading/dependent types, e.g. their example with pow function. In c++ you'd have two overloads:
float pow(float, float)
int pow(int, int)
Whereas in python, even though you can achieve the equivalent behaviour in runtime, mypy (at least until recently) couldn't express this, so you had to define something like def pow(base: Union[int, float], power: Union[int, float]) -> Union[int, float]
Which might be annoying on call sites when you do expect the return type to be int (but there is no way for mypy to know that with such signature).In my case I do want to return a variant type unconditionally, so this warning doesn't really apply. It's more similar to an Optional type (just instead of None I am using a more meaningful Exception): while it's not great if your code is riddled with optional return types, sometimes you don't have other choice but using it.
from typing import TypeVar
T = TypeVar('T', int, float)
def pow(base: T, power: T) -> T: ...As evidenced by your comment, most people forget about negative exponents. The vast majority of usage is positive exponents; people expect an int back when they do `pow(2, 2)` and returning a Union or float would result in annoying false positives.