DOC: Document array_function at a higher level. #14058
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #13979 .
Closes #13844
This PR adds a new document illustrating a very simple custom array container implementing
__array_ufunc__
and__array_function__
. It also rephrases the documentation on subclasses to direct users toward considering dispatch instead of inheritance.Additional work is needed to restructure the documentation to make this new document easier for developers to discover and to provide more context about when to choose inheritance (rarely but sometimes still the right choice) or dispatch. I propose to defer that larger effort to a separate PR and get this published soon so that some high-level documentation on
__array_function__
is at least available.Feel free to take a heavy hand to this in reviewing/editing. I wrote this with the perspective of someone who has been following the
__array_function__
conversation but has not thought deeply about the design.