-
Notifications
You must be signed in to change notification settings - Fork 52
Update typing for array object dunder methods #173
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kgryte. LGTM.
Technically int
is a subtype of float
so not necessary to include (and there's a mypy guideline saying to not do Union[int, float]
when you can simply do float
, however for clarity I think it's preferred to do so here anyway.
|
That does sound right,
Not that I know of. |
Actually, I didn't notice that the spec says "numeric data type" for |
Ah that should be made consistent. And negative integers should be disallowed I believe. |
Previously it was any numeric dtype, but this was inconsistent with the functions pow() and divide(). Integer inputs are problematic because they would either always have to be cast to float or use value-based casting depending on, e.g., the sign of the exponent for __pow__. Furthermore, in order to properly correspond to Python conventions, __truediv__ should always return a float (integer division should be implemented by __floordiv__). This was discussed in data-apis#173.
This PR
MUST
vsSHOULD
, etc).