-
Notifications
You must be signed in to change notification settings - Fork 478
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
Calling the ufunc in __array_wrap__ is probably a bad idea #424
Comments
I agree but there is no other way, as far as I now. I discuss this in the past with the numpy devs but there was no big interest to do provide a way to circunvent it. Recently the has been a discussion to add a new way to do this. It is still unstable. |
Here's a possible workaround:
Yes, this violates the "attempt[ing] to access array data" rule, but calling the ufunc within Could you link me to that discussion? |
Take a look at numpy/numpy#4072 |
Thanks, although that doesn't seem all that relevant to this discussion - the issue here is that you're not able to override ufunc behaviour at all, derivative of np.array or otherwise. Also, there's some work in the numpy development pipeline to fix this with What are your thoughts on my proposed workaround above? |
Your workaround looks ok in theory. If you like, prototype it and we test it. However, at the end the numpy devs need to provide a good way to do this. By the way, have you seen #326 ? |
Since by that point, the ufunc has already run once. Although putting it in
__array_prepare__
may also not solve the problem, since that:The text was updated successfully, but these errors were encountered: