diff options
author | Blake Griffith <blake.a.griffith@gmail.com> | 2014-01-04 12:59:38 -0600 |
---|---|---|
committer | Blake Griffith <blake.a.griffith@gmail.com> | 2014-01-04 12:59:38 -0600 |
commit | d849245b44417e3e632a19a5e04a627ca6434887 (patch) | |
tree | a11f281e1aed604b6db449d54dd76072652418b9 /doc/neps | |
parent | 192355eb77883b1bd779f0a0bbad9e137de3193d (diff) | |
download | numpy-d849245b44417e3e632a19a5e04a627ca6434887.tar.gz |
BUG DOC TST: Allow __numpy_ufunc__ to handle multiple output ufuncs.
Added details about how the output variables are handled to the spec.
Also adds tests for ufuncs with multiple outputs.
Diffstat (limited to 'doc/neps')
-rw-r--r-- | doc/neps/ufunc-overrides.rst | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/doc/neps/ufunc-overrides.rst b/doc/neps/ufunc-overrides.rst index f57e77054..5a0a0334f 100644 --- a/doc/neps/ufunc-overrides.rst +++ b/doc/neps/ufunc-overrides.rst @@ -131,11 +131,22 @@ Here: - *i* is the index of *self* in *inputs*. - *inputs* is a tuple of the input arguments to the ``ufunc`` - *kwargs* are the keyword arguments passed to the function. The ``out`` - argument is always contained in *kwargs*, if given. + arguments are always contained in *kwargs*, how positional variables + are passed is discussed below. The ufunc's arguments are first normalized into a tuple of input data -(``inputs``), and dict of keyword arguments. If the output argument is -passed as a positional argument it is moved to the keyword argmunets. +(``inputs``), and dict of keyword arguments. If there are output +arguments they are handeled as follows: + +- One positional output variable x is passed in the kwargs dict as ``out : + x``. +- Multiple positional output variables ``x0, x1, ...`` are passed as a tuple + in the kwargs dict as ``out : (x0, x1, ...)``. +- Keyword output variables like ``out = x`` and ``out = (x0, x1, ...)`` are + passed unchanged to the kwargs dict like ``out : x`` and ``out : (x0, x1, + ...)`` respectively. +- Combinations of positional and keyword output variables are not + supported. The function dispatch proceeds as follows: |