New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
numbers module #11863
Comments
Please note that your IDE's understanding of the types is a poor representation of how the types are annotated in typeshed. Lines 91 to 92 in 4005c2f
Lines 4 to 8 in 4005c2f
We of course accept any improvements in this area (and everywhere else)! |
Well, my type checker (pyright) does consider float as a suclass of Real, so the way it works seems right to me considering the information that it's given. But having thought a little about it, maybe an implementation of Rational that would return a complex from the division of two rationals may fit in the python bounds of the numbers interface. Hell, it may even make some mathematical sense for all I know. |
The signature of
Rational.__truediv__
is marked as the following:First of,
_ComplexLike
sounds like it should benumbers.Complex
. But second, the signature should be more refined :numbers.Complex
instead of Unknown. The typing signature should be(self, Complex) -> Complex
.(self, Real) -> Real
overload should be defined. And as a bonus, a(self, Rational) -> Rational
one too.The text was updated successfully, but these errors were encountered: