Guido van Rossum <gu...@python.org> added the comment:

It never occurred to me that making b&b an b|b return bool would be considered 
a bad thing just because ~b is not a bool. That's like complaining that 1+1 
returns an int rather than a float for consistency with 1/2 returning a float.

Because bool is embedded in int, it's okay to return a bool value *that 
compares equal to the int from the corresponding int operation*. Code that 
accepts ints and is passed bools will continue to work. But if we were to make 
~b return `not b`, that makes bool not embedded in int (for the sake of numeric 
operations).

Take for example

def f(a: int) -> int:
    return ~a

I don't think it's a good idea to make f(0) != f(False).

----------

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

Reply via email to