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

Tim Peters report at bugs.python.org
Mon Sep 9 12:43:11 EDT 2019


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

BTW, the docs also spell out that "and" and "or" ALWAYS evaluate their left operand before their right operand, and don't evaluate the right operand at all if the result of evaluating the left operand is true (for "or") or false (for "and").  So, e.g., 

    result = (EXPR1) or (EXPR2)

acts like

    result = EXPR1
    if not bool(result):
        result = EXPR2

----------

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


More information about the Python-bugs-list mailing list