Message349707
| 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). |
|