Raymond Hettinger added the comment:

>>> ... it would be nice if ~ acted as negation on bools (~False being
>>> True and ~True being false) instead of mapping them to -1 and -2 
>>> as it currently does.

I'm strongly against this proposal for several reasons.

1. One way to do it.  We don't need a second way to spell "not x".  As a Python 
teacher, I will find it harder to explain the language with this change 
(sometimes ~ sometimes means bitwise-not and sometimes it means "not").

2. We were supposed to learn from our mistake using "%" for string formatting 
which causes problems because the operator precedence was the same as 
multiplication and division and inappropriate for formatting.   In the case, 
the precedence for the bitwise-and/or/not is very different from 
boolean-and/or/not (the former occur before comparisons and the latter occur 
after comparisons).

3. Not all Liskov violations matter, but it is not uncommon to rely on True and 
False being interchangeable with 1 and 0.  I suspect this change will break 
some existing code in a way that is hard to find and may not be covered by 
existing unit tests.

4. If we care at all about Python 3 adoption, we will stop introducing hundreds 
of little breakages and changes in meaning that add almost no value but do 
increase the difficultly (and cost) of moving to Python 3.  Guido has referred 
to this as "death by a thousand cuts".

So please put me down with R. David Murray as recommending that this proposal 
to be deemed "officially dropped".

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27754>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to