Message349495
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. |
|
Date |
User |
Action |
Args |
2019-08-12 20:53:45 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, tomerv |
2019-08-12 20:53:45 | tim.peters | set | messageid: <1565643225.11.0.361531125523.issue37831@roundup.psfhosted.org> |
2019-08-12 20:53:45 | tim.peters | link | issue37831 messages |
2019-08-12 20:53:44 | tim.peters | create | |
|