Message349707
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). |
|
Date |
User |
Action |
Args |
2019-08-14 14:40:10 | gvanrossum | set | recipients:
+ gvanrossum, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, eryksun, tomerv |
2019-08-14 14:40:10 | gvanrossum | set | messageid: <1565793610.43.0.772078484889.issue37831@roundup.psfhosted.org> |
2019-08-14 14:40:10 | gvanrossum | link | issue37831 messages |
2019-08-14 14:40:10 | gvanrossum | create | |
|