Skip to content

Dask Array's NEP-13 should delegate to __array_ufunc__ #6673

@ravwojdyla

Description

@ravwojdyla

Dask Array's binops (__add__ etc) should delegate to __array_ufunc__. This issue is a follow up from #6632 (comment).

This kind of routing from binops to __array_ufunc__ is the recommended solution from NEP-13. Right now for example (arr is a Dask Array) np.add(arr, x) and arr + x uses slightly different code path, which introduces a chance for bugs, inconsistencies etc. To be clear, in the example above np.add(arr, x) is routing via NEP-13's __array_ufunc__, whilst arr + x is routing via python's __add__, and __add__ doesn't delegate to __array_ufunc__, which I would argue it should.

A solution to this would be to just implement the suggested NEP-13 routing via __array_ufunc__ and make sure that __array_ufunc__ properly handles delegations from binops.

Environment:

  • Dask version: 2.27.0/master

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrayneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions