{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/29730197","id":29730197,"diff_hunk":"@@ -901,22 +901,32 @@ class _MaskedBinaryOperation:\n         Filling value for the first argument, default is 0.\n     filly : scalar, optional\n         Filling value for the second argument, default is 0.\n-\n+    op    : bool, optional\n+        Set to true when used in (non-reversed) binary operators.\n     \"\"\"\n-    def __init__ (self, mbfunc, fillx=0, filly=0):\n+    def __init__ (self, mbfunc, fillx=0, filly=0, op=False):\n         \"\"\"abfunc(fillx, filly) must be defined.\n            abfunc(x, filly) = x for all x to enable reduce.\n         \"\"\"\n         self.f = mbfunc\n         self.fillx = fillx\n         self.filly = filly\n+        self.op = op\n         self.__doc__ = getattr(mbfunc, \"__doc__\", str(mbfunc))\n         self.__name__ = getattr(mbfunc, \"__name__\", str(mbfunc))\n         ufunc_domain[mbfunc] = None\n         ufunc_fills[mbfunc] = (fillx, filly)\n \n+    def __get__(self, obj, type=None):\n+        return partial(self, obj)\n+\n     def __call__ (self, a, b, *args, **kwargs):\n         \"Execute the call behavior.\"\n+        # Check array priority\n+        if self.op:","path":"numpy/ma/core.py","position":46,"original_position":46,"commit_id":"f9e7725eecd02d74eef3f5fd884bce714efe6e8e","original_commit_id":"f9e7725eecd02d74eef3f5fd884bce714efe6e8e","user":{"login":"mhvk","id":2789820,"avatar_url":"https://avatars.githubusercontent.com/u/2789820?v=3","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false},"body":"In `ndarray` C code, `NotImplemented` is only returned if the array priority is higher *and* the other class defines the reverse operation. I think one could use a similar structure as you have here, except use `rop` to pass on the reverse operator and here do:\r\n```\r\nif self.rop and getattr(b, self.rop, None) and getattr(b, '__array_priority__', -1) > a.__array_priority__:\r\n    return NotImplemented\r\n```","created_at":"2015-05-06T02:05:42Z","updated_at":"2015-05-06T02:05:42Z","html_url":"https://github.com/numpy/numpy/pull/5230#discussion_r29730197","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/5230","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/29730197"},"html":{"href":"https://github.com/numpy/numpy/pull/5230#discussion_r29730197"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5230"}}},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/5230","id":23303472,"html_url":"https://github.com/numpy/numpy/pull/5230","diff_url":"https://github.com/numpy/numpy/pull/5230.diff","patch_url":"https://github.com/numpy/numpy/pull/5230.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/5230","number":5230,"state":"open","locked":false,"title":"BUG: MaskedArray ignores __array_priority__","user":{"login":"abalkin","id":535197,"avatar_url":"https://avatars.githubusercontent.com/u/535197?v=3","gravatar_id":"","url":"https://api.github.com/users/abalkin","html_url":"https://github.com/abalkin","followers_url":"https://api.github.com/users/abalkin/followers","following_url":"https://api.github.com/users/abalkin/following{/other_user}","gists_url":"https://api.github.com/users/abalkin/gists{/gist_id}","starred_url":"https://api.github.com/users/abalkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalkin/subscriptions","organizations_url":"https://api.github.com/users/abalkin/orgs","repos_url":"https://api.github.com/users/abalkin/repos","events_url":"https://api.github.com/users/abalkin/events{/privacy}","received_events_url":"https://api.github.com/users/abalkin/received_events","type":"User","site_admin":false},"body":"fixes: #5227 \r\n\r\nThis patch partially fixes the issue (I only covered addition, subtraction and multiplication).  If you agree that this is the right approach - I will add remaining operations.","created_at":"2014-10-24T15:25:37Z","updated_at":"2015-05-06T02:05:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6411c699c9deffc69ebc8395ecc61d57966704e3","assignee":null,"milestone":{"url":"https://api.github.com/repos/numpy/numpy/milestones/35","html_url":"https://github.com/numpy/numpy/milestones/1.10.0%20release","labels_url":"https://api.github.com/repos/numpy/numpy/milestones/35/labels","id":1055363,"number":35,"title":"1.10.0 release","description":"Marker for PRs that should go into Numpy 1.10.1.","creator":{"login":"charris","id":77272,"avatar_url":"https://avatars.githubusercontent.com/u/77272?v=3","gravatar_id":"","url":"https://api.github.com/users/charris","html_url":"https://github.com/charris","followers_url":"https://api.github.com/users/charris/followers","following_url":"https://api.github.com/users/charris/following{/other_user}","gists_url":"https://api.github.com/users/charris/gists{/gist_id}","starred_url":"https://api.github.com/users/charris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charris/subscriptions","organizations_url":"https://api.github.com/users/charris/orgs","repos_url":"https://api.github.com/users/charris/repos","events_url":"https://api.github.com/users/charris/events{/privacy}","received_events_url":"https://api.github.com/users/charris/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":21,"state":"open","created_at":"2015-04-07T00:02:10Z","updated_at":"2015-05-06T00:47:15Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/5230/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/5230/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/5230/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/f9e7725eecd02d74eef3f5fd884bce714efe6e8e","head":{"label":"abalkin:issue5227","ref":"issue5227","sha":"f9e7725eecd02d74eef3f5fd884bce714efe6e8e","user":{"login":"abalkin","id":535197,"avatar_url":"https://avatars.githubusercontent.com/u/535197?v=3","gravatar_id":"","url":"https://api.github.com/users/abalkin","html_url":"https://github.com/abalkin","followers_url":"https://api.github.com/users/abalkin/followers","following_url":"https://api.github.com/users/abalkin/following{/other_user}","gists_url":"https://api.github.com/users/abalkin/gists{/gist_id}","starred_url":"https://api.github.com/users/abalkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalkin/subscriptions","organizations_url":"https://api.github.com/users/abalkin/orgs","repos_url":"https://api.github.com/users/abalkin/repos","events_url":"https://api.github.com/users/abalkin/events{/privacy}","received_events_url":"https://api.github.com/users/abalkin/received_events","type":"User","site_admin":false},"repo":{"id":6536333,"name":"numpy","full_name":"abalkin/numpy","owner":{"login":"abalkin","id":535197,"avatar_url":"https://avatars.githubusercontent.com/u/535197?v=3","gravatar_id":"","url":"https://api.github.com/users/abalkin","html_url":"https://github.com/abalkin","followers_url":"https://api.github.com/users/abalkin/followers","following_url":"https://api.github.com/users/abalkin/following{/other_user}","gists_url":"https://api.github.com/users/abalkin/gists{/gist_id}","starred_url":"https://api.github.com/users/abalkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalkin/subscriptions","organizations_url":"https://api.github.com/users/abalkin/orgs","repos_url":"https://api.github.com/users/abalkin/repos","events_url":"https://api.github.com/users/abalkin/events{/privacy}","received_events_url":"https://api.github.com/users/abalkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abalkin/numpy","description":"Numpy main repository","fork":true,"url":"https://api.github.com/repos/abalkin/numpy","forks_url":"https://api.github.com/repos/abalkin/numpy/forks","keys_url":"https://api.github.com/repos/abalkin/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abalkin/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abalkin/numpy/teams","hooks_url":"https://api.github.com/repos/abalkin/numpy/hooks","issue_events_url":"https://api.github.com/repos/abalkin/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/abalkin/numpy/events","assignees_url":"https://api.github.com/repos/abalkin/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/abalkin/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/abalkin/numpy/tags","blobs_url":"https://api.github.com/repos/abalkin/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abalkin/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abalkin/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/abalkin/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abalkin/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/abalkin/numpy/languages","stargazers_url":"https://api.github.com/repos/abalkin/numpy/stargazers","contributors_url":"https://api.github.com/repos/abalkin/numpy/contributors","subscribers_url":"https://api.github.com/repos/abalkin/numpy/subscribers","subscription_url":"https://api.github.com/repos/abalkin/numpy/subscription","commits_url":"https://api.github.com/repos/abalkin/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/abalkin/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/abalkin/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/abalkin/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/abalkin/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/abalkin/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abalkin/numpy/merges","archive_url":"https://api.github.com/repos/abalkin/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abalkin/numpy/downloads","issues_url":"https://api.github.com/repos/abalkin/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/abalkin/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/abalkin/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/abalkin/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abalkin/numpy/labels{/name}","releases_url":"https://api.github.com/repos/abalkin/numpy/releases{/id}","created_at":"2012-11-04T22:35:09Z","updated_at":"2015-04-23T17:57:09Z","pushed_at":"2015-04-23T17:57:08Z","git_url":"git://github.com/abalkin/numpy.git","ssh_url":"git@github.com:abalkin/numpy.git","clone_url":"https://github.com/abalkin/numpy.git","svn_url":"https://github.com/abalkin/numpy","homepage":"http://www.numpy.org/","size":36819,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"06256714cb6209db5a3fac3681ebfad1ffe715de","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"repo":{"id":908607,"name":"numpy","full_name":"numpy/numpy","owner":{"login":"numpy","id":288276,"avatar_url":"https://avatars.githubusercontent.com/u/288276?v=3","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numpy/numpy","description":"Numpy main repository","fork":false,"url":"https://api.github.com/repos/numpy/numpy","forks_url":"https://api.github.com/repos/numpy/numpy/forks","keys_url":"https://api.github.com/repos/numpy/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numpy/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numpy/numpy/teams","hooks_url":"https://api.github.com/repos/numpy/numpy/hooks","issue_events_url":"https://api.github.com/repos/numpy/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/numpy/numpy/events","assignees_url":"https://api.github.com/repos/numpy/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/numpy/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/numpy/numpy/tags","blobs_url":"https://api.github.com/repos/numpy/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numpy/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numpy/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/numpy/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/numpy/numpy/languages","stargazers_url":"https://api.github.com/repos/numpy/numpy/stargazers","contributors_url":"https://api.github.com/repos/numpy/numpy/contributors","subscribers_url":"https://api.github.com/repos/numpy/numpy/subscribers","subscription_url":"https://api.github.com/repos/numpy/numpy/subscription","commits_url":"https://api.github.com/repos/numpy/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/numpy/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/numpy/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/numpy/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/numpy/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/numpy/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numpy/numpy/merges","archive_url":"https://api.github.com/repos/numpy/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numpy/numpy/downloads","issues_url":"https://api.github.com/repos/numpy/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/numpy/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/numpy/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/numpy/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numpy/numpy/labels{/name}","releases_url":"https://api.github.com/repos/numpy/numpy/releases{/id}","created_at":"2010-09-13T23:02:39Z","updated_at":"2015-05-05T23:42:36Z","pushed_at":"2015-05-05T20:22:36Z","git_url":"git://github.com/numpy/numpy.git","ssh_url":"git@github.com:numpy/numpy.git","clone_url":"https://github.com/numpy/numpy.git","svn_url":"https://github.com/numpy/numpy","homepage":"http://www.numpy.org/","size":64965,"stargazers_count":1905,"watchers_count":1905,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":972,"mirror_url":null,"open_issues_count":845,"forks":972,"open_issues":845,"watchers":1905,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5230"},"html":{"href":"https://github.com/numpy/numpy/pull/5230"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/5230"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/5230/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5230/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5230/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/f9e7725eecd02d74eef3f5fd884bce714efe6e8e"}}}}