diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-05-05 11:53:26 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-05 11:53:26 -0600 |
commit | eccfe737c2811aed01fe52ac9db441ab93ff9831 (patch) | |
tree | dc7beb75d966da644dedd87da53b77582d1e3fe0 | |
parent | 9e5786bce33e78cd7b9dc4ffb68dd173f31e0a33 (diff) | |
download | numpy-eccfe737c2811aed01fe52ac9db441ab93ff9831.tar.gz |
DOC: Improve wording in ufunc_override NEP.
Clarify the role of `array_ufunc` in overriding Python numeric operators.
-rw-r--r-- | doc/neps/ufunc-overrides.rst | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/neps/ufunc-overrides.rst b/doc/neps/ufunc-overrides.rst index 82b297411..f468a8ca1 100644 --- a/doc/neps/ufunc-overrides.rst +++ b/doc/neps/ufunc-overrides.rst @@ -466,10 +466,11 @@ implements the following behavior: - Otherwise, :class:`ndarray` unilaterally calls the corresponding Ufunc. Ufuncs never return ``NotImplemented``, so **reflexive methods such as** ``other.__rmul__`` **cannot be used to override arithmetic with - NumPy arrays if** ``__array_ufunc__`` **is set**. Instead, the resulting - behavior can be modified by implementing ``__array_ufunc__`` in a - consistent fashion for the corresponding Ufunc (e.g., ``np.multiply``, see - :ref:`neps.ufunc-overrides.list-of-operators`). + NumPy arrays if** ``__array_ufunc__`` **is set** to any value other than + ``None``. Instead, their behavior needs to be changed by implementing + ``__array_ufunc__`` in a fashion consistent with the corresponding Ufunc, + e.g., ``np.multiply``. See :ref:`neps.ufunc-overrides.list-of-operators` + for a list of affected operators and their corresponding ufuncs. A class wishing to modify the interaction with :class:`ndarray` in binary operations therefore has two options: |