Skip to content

MaskedArray ignores __array_priority__ #5227

@abalkin

Description

@abalkin

Given a class like this:

class X(int):
    def __add__(self, other):
        return 42
    def __radd__(self, other):
        return 24
    __array_priority__ = 20

Adding to a numpy array works as expected:

>>> np.array(2) + X()
24

However, when I add X() to a masked array, X.__radd__ is not called:

>>> np.ma.array(2) + X()
2

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