Tim Peters <[email protected]> added the comment:
I don't agree that "~" doesn't "work". If people are reading it as "not",
they're in error. The Python docs say ~x
means
the bits of x inverted
and that's what it does. There's no sense it which it was _intended_ to be
logical negation, no more in Python than in C (C has the distinct unary prefix
"!" operator for truthiness negation, and, as you note, Python has "not").
It's educational ;-) to learn how analogies between ints and bools can break
down. For logical negation in the sense they want here, it's not "~x" they
want but "~x & 1" - that is, if someone insists on using an inappropriate
operator.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37831>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com