This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients eryksun, gvanrossum, mark.dickinson, rhettinger, serhiy.storchaka, tim.peters, tomerv
Date 2019-08-14.14:40:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565793610.43.0.772078484889.issue37831@roundup.psfhosted.org>
In-reply-to
Content
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).
History
Date User Action Args
2019-08-14 14:40:10gvanrossumsetrecipients: + gvanrossum, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, eryksun, tomerv
2019-08-14 14:40:10gvanrossumsetmessageid: <1565793610.43.0.772078484889.issue37831@roundup.psfhosted.org>
2019-08-14 14:40:10gvanrossumlinkissue37831 messages
2019-08-14 14:40:10gvanrossumcreate