Thanks to visit codestin.com
Credit goes to github.com

Skip to content

__numpy_ufunc__ confusion in docs #9252

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

Open
jbrockmendel opened this issue Jun 14, 2017 · 4 comments
Open

__numpy_ufunc__ confusion in docs #9252

jbrockmendel opened this issue Jun 14, 2017 · 4 comments

Comments

@jbrockmendel
Copy link
Contributor

The top results for Google searches like "numpy subclass ndarray" point toward the 1.12.0 docs. Three requests/suggestions.

  1. A prominent "There is a newer version" link to the 1.13.0 docs.

  2. The 1.12.0 page linked above directs the user to use __numpy_ufunc__ for subclassing. I'm not entirely clear on the timeline in ENH: Add __array_ufunc__ #8247, but I couldn't make numpy_ufunc work with 1.12.0, so it isn't obvious whether the doc is accurate or (much more likely) I'm screwing up.

  3. A non-toy example for numpy_ufunc and/or array_ufunc, ideally demonstrating the tie-ins or use cases for the array_prepare/array_finalize/...

@mhvk
Copy link
Contributor

mhvk commented Jun 14, 2017

@jbrockmendel - not sure we can still change the 1.12.0 documentation, though if it is possible, I'd be all for it. In any case, only __array_ufunc__ actually exists, and the 1.13.0 documentation has more information [1]. If you want a more complete/complicated example of its use, see astropy/astropy#2583 for work I did for astropy's Quantity class.

[1] https://docs.scipy.org/doc/numpy/neps/ufunc-overrides.html, https://docs.scipy.org/doc/numpy/reference/arrays.classes.html

@jbrockmendel
Copy link
Contributor Author

Thanks, I'd been using an older version of astropy.units as a template for poking at __array_wrap__, hadn't seen the version in 2583. Using __array_ufunc__ tentatively seems to solve my use case quite cleanly.

I had seen the neps/ufunc-overrides.html page, but did not see anything saying "this is now implemented". Maybe that can go on the wish-list along with updating the 1.12.0 docs.

@mhvk
Copy link
Contributor

mhvk commented Jun 15, 2017

Yes, someone elsewhere mentioned that the release notes seem to be missing! (It was in the e-mail @charris sent, but someone not elsewhere)

@rgommers
Copy link
Member

I don't think we still want to amend the 1.12.0 docs at this point, however a There is a newer version banner for all new doc builds would be nice to have.

Yes, someone elsewhere mentioned that the release notes seem to be missing!

That was fixed: https://docs.scipy.org/doc/numpy/release.html

I had seen the neps/ufunc-overrides.html page, but did not see anything saying "this is now implemented".

https://docs.scipy.org/doc/numpy/neps/index.html has two sections, Implemented NEPS and Other NEPS. https://docs.scipy.org/doc/numpy/neps/ufunc-overrides.html is under the former, and is up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants