"spir" <denis.s...@free.fr> wrote
Here is an overal and a trial to introduce my view on this topic.
...
* The mix of "extended logic" on non-logical types and treating
integers
as bit sequences provakes a kind of conceptual collision.
* As a solution, bitwise operations may apply only to a type (byte
or int)
on which "extended logic" raises an TypeError.
You are probably correct but it would break a ton of working code!
Especially when you recall that bool types were only introduced
relatively recently so a lot of old code relies on the fact that
True/False were until then literally 1/0.
Maybe it is "improved" in Python 3. As you say the ~ operator
makes most sense if applied to bytes only. But for compatibility
reasons I suspect they have kept it as-is...
Alan G
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor