8000 BUG cannot specify second output to ufunc as keyword argument · Issue #4752 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG cannot specify second output to ufunc as keyword argument #4752
@mhvk

Description

@mhvk

Currently, it does not seem possible to pass on an array to catch the second output of a ufunc via a keyword parameter:

a1 = np.array([1.])
a2 = np.array([1.])
np.modf(1.333, out=a1, out2=a2)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-9ca83f6d80bd> in <module>()
----> 1 np.modf(1.333, out=a1, out2=a2)

ValueError: cannot specify 'out' as both a positional and keyword argument

One can do np.modf(1.333, out=a1), which works as expected. If one gives instead np.modf(1.333, out2=a2), the first part is assigned to a2. (Note that the documentation suggests to use out1, out2, but any characters after out simply seem to be skipped.)

It would seem good to have the option of giving these as keyword arguments. One solution might be to have it be consistent with the usage in __numpy_ufunc__, i.e., one would give np.modf(values, out=(a1, a2)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0