[issue38060] precedence (relational, logical operator)not working with single value

Tim Peters report at bugs.python.org
Sun Sep 8 23:55:13 EDT 2019


Tim Peters <tim at python.org> added the comment:

It's working fine.  What do you expect?  For example,

    9 or 7 > "str"

groups as

    9 or (7 > "str")

9 is evaluated for "truthiness" first, and since it's not 0 it's considered to be true.  That's enough to determine the result of "or", so (7 > "str") isn't evaluated at all.  9 is the result.

This is all working as designed and as documented, so I'm closing this report.

----------
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list