[issue42460] Wrong Output

Steven D'Aprano report at bugs.python.org
Wed Nov 25 04:56:51 EST 2020


Steven D'Aprano <steve+python at pearwood.info> added the comment:

Correct output.

https://docs.python.org/3/reference/expressions.html#operator-precedence

a = 10
b = 10
(a >= 10) and not (b == 10) | 7+2 == 9

returns False because of operator precedence. It evaluates like this:

(a >= 10) and not (b == 10) | 7+2 == 9
--> True and not True | 7+2 == 9
--> True and not True | 9 == 9
--> True and not 9 == 9
--> True and not True
--> True and False
--> False

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42460>
_______________________________________


More information about the Python-bugs-list mailing list