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
Why does ~True evaluate to -2 ? #293
Comments
Thanks for the suggestion.
I think this would be a good addition to the collection (if someone's up for the challenge, most welcome :), otherwise I'll add it in next major revision) because it's sometimes tempting to use >>> True == ~False
False and of course also because numpy handles it differently as you suggested (need to look deeper into it). |
Thanks for the explanation. This is frightening as I might have used this before... |
thank you, this is interesting :) >>> ~True
-2
>>> ~False
-1
>>> ~True + ~False
-3 and I didn't know you can even add True to integer: >>> 5 + True
6 |
I don't see it in the list. Working in a jupyter notebook ~True evaluates to -2. ( ~np.array(True) correctly evaluates to False).
Can someone explain the answer ? Does it need to be added in the list ?
The text was updated successfully, but these errors were encountered: