-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Revert "DEP: Raise TypeError for subtract(bool_, bool_)." #9255
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
Revert "DEP: Raise TypeError for subtract(bool_, bool_)." #9255
Conversation
I would also revert the error for negative and positive for consistency. |
numpy/core/tests/test_scalarmath.py
Outdated
a = np.ones((), dtype=np.bool_)[()] | ||
assert_raises(TypeError, operator.sub, a, a) | ||
|
||
def test_result(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there's no reason to lose this second test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
This reverts commit c9adc35.
7fec80d
to
45598d7
Compare
If someone reports a problem I will consider it. Note that |
Can you elaborate on when this is true? Or are you just remarking that only one of these gives a TypeError |
Also it conflicts with Python.
|
@eric-wieser I was just remarking on the state before the deprecations where the unary |
Perhaps then the deprecation should become a futurewarning, after which the loop becomes |
IIRC, we basically said that we should first make it an error a while, and then pick up that discussion @eric-wieser. |
The python behavior is also pretty weird, and reflects the their history of using 0 and 1 as the bools for a long time, and then adding False and True as effectively aliases for those. (Notice |
OK, putting this in. Might to this for 1.14 later as the deprecation cycle is just getting underway for real ;) |
We could even go for the VisibleDeprecationWarning for 1.14 if we expect more problems (especially, if we expect not too uncommon usage in small scripts, etc.) |
@seberg Yeah, that might be a good idea, raising a exception sure helped visibility... |
This seems like a nice idea. In fact it is more informative that |
@jakirkham Might want to open issue, it would be more visible than this merged PR. |
This reverts commit c9adc35.
Don't raise
TypeError
for boolean subtraction in Numpy 1.13, see discussion at #9251.Closes #9251.