-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Accept superclasses in NEP-13/17 dispatching #6710
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
Accept superclasses in NEP-13/17 dispatching #6710
Conversation
|
@jthielen I'll add tests here specifically for binops, ufuncs, and
It's hard to say where to draw the line on testing support for inheritance though, so I'll focus just on the things this PR is meant to address. |
|
Apologies for the delay in review here @gjoseph92. I'm hoping to take a look later in the week. In the meantime, #6734 came up. Do you know if this affects it at all (at a glance, I think the answer is no)? |
Thanks for the mention of that issue @TomAugspurger! I've added a comment about what I think is going on there. If it is what I think it is, then I don't believe it affects this PR. |
|
@gjoseph92 checking in here, should we merge main into this branch and see the status of CI, or is this work stale? |
|
Might as well merge main, I think this is still a valid change. I can tell you it's been running in production for over two years and never caused issues there :) |
|
Ci is green after merging main. @TomAugspurger since you initially reviewed this PR, would you mind giving it a last check and if things look good we can merge it in? |
|
Thanks @ncclementi @TomAugspurger, I never thought this would end up getting in! |
Follow-up/alternative to #6706.
When dispatching NumPy functions, this causes
dask.Array(and its subclasses) to accept any of its parent classes in__array_function__and__array_ufunc__, as recommended in NEP-13. This makes it easier to subclassArray, since:__array_function__/__array_ufunc__inherit an implementation that accepts both them and plaindask.Arrays (their parent class).__array_function__/__array_ufunc__call that method onsuper(), it won't always delegate to the other object simply because the method was overridden—it'll only delegate if the other implements the function and isn't a parent class.cc @jthielen
black dask/flake8 dask