Skip to content
Myr

Slightly improve clarity of logical bool ops (#1938)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 619d8ee, 64a6bd1 · Browse files · 1 file+17 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−13 removed

  • other:+17 added−13 removed

1 file+17 added−13 removed

modified:docs/templates.rst+17 added-13 removed
1410 unmodified lines
14111412Logic1413~~~~~14141415For ``if`` statements, ``for`` filtering, and ``if`` expressions, it can be useful to1416combine multiple expressions:1415For ``if`` statements, ``for`` filtering, and ``if`` expressions, it can be1416useful to combine multiple expressions.14171418``and``1419 Return true if the left and the right operand are true.1419 For ``x and y``, if ``x`` is false, then the value is ``x``, else ``y``. In1420 a boolean context, this will be treated as ``True`` if both operands are1421 truthy.14221423``or``1422 Return true if the left or the right operand are true.1424 For ``x or y``, if ``x`` is true, then the value is ``x``, else ``y``. In a1425 boolean context, this will be treated as ``True`` if at least one operand is1426 truthy.14271428``not``1425 negate a statement (see below).1429 For ``not x``, if ``x`` is false, then the value is ``True``, else1430 ``False``.14311427``(expr)``1428 Parentheses group an expression.14291430.. admonition:: Note14311432 The ``is`` and ``in`` operators support negation using an infix notation,1433 too: ``foo is not bar`` and ``foo not in bar`` instead of ``not foo is bar``1434 and ``not foo in bar``. All other expressions require a prefix notation:1432 Prefer negating ``is`` and ``in`` using their infix notation:1433 ``foo is not bar`` instead of ``not foo is bar``; ``foo not in bar`` instead1434 of ``not foo in bar``. All other expressions require prefix notation:1435 ``not (foo and bar).``14361437``(expr)``1438 Parentheses group an expression. This is used to change evaluation order, or1439 to make a long expression easier to read or less ambiguous.144014411442Other Operators1443~~~~~~~~~~~~~~~14441445The following operators are very useful but don't fit into any of the other
517 unmodified lines