Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MaskedArray ignores __array_priority__ #5227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abalkin opened this issue Oct 24, 2014 · 3 comments
Closed

MaskedArray ignores __array_priority__ #5227

abalkin opened this issue Oct 24, 2014 · 3 comments

Comments

@abalkin
Copy link
Contributor

abalkin commented Oct 24, 2014

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
@charris
Copy link
Member

charris commented May 5, 2015

The problem solved seems similar to #3907.

@mhvk
Copy link
Contributor

mhvk commented Jun 17, 2015

This seems resolved in current master (with #5964 merged). @abalkin - can this be closed?

@jjhelmus
Copy link
Contributor

This has been fixed, closing. Thanks for the heads up and fix @mhvk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants