diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index b68c29860cf..9cbbc10f8c9 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1359,12 +1359,12 @@ Comparisons yield boolean values: ``True`` or ``False``. .. index:: pair: chaining; comparisons Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent to -``x < y and y <= z``, except that ``y`` is evaluated only once (but in both +``( x < y and y <= z )``, except that ``y`` is evaluated only once (but in both cases ``z`` is not evaluated at all when ``x < y`` is found to be false). Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, *op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN z`` is equivalent -to ``a op1 b and b op2 c and ... y opN z``, except that each expression is +to a single expression ``( a op1 b and b op2 c and ... y opN z )``, except that each expression is evaluated at most once. Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* and