mirror of https://github.com/python/cpython
parent
df708788b6
commit
6cb64f9e46
|
@ -2039,12 +2039,13 @@ the highest priority, and \code{or} the lowest, so that
|
||||||
course, parentheses can be used to express the desired composition.
|
course, parentheses can be used to express the desired composition.
|
||||||
|
|
||||||
The Boolean operators \code{and} and \code{or} are so-called
|
The Boolean operators \code{and} and \code{or} are so-called
|
||||||
\emph{shortcut} operators: their arguments are evaluated from left to
|
\emph{short-circuit} operators: their arguments are evaluated from
|
||||||
right, and evaluation stops as soon as the outcome is determined.
|
left to right, and evaluation stops as soon as the outcome is
|
||||||
E.g., if \code{A} and \code{C} are true but \code{B} is false, \code{A
|
determined. For example, if \code{A} and \code{C} are true but
|
||||||
and B and C} does not evaluate the expression C. In general, the
|
\code{B} is false, \code{A and B and C} does not evaluate the
|
||||||
return value of a shortcut operator, when used as a general value and
|
expression \code{C}. In general, the return value of a short-circuit
|
||||||
not as a Boolean, is the last evaluated argument.
|
operator, when used as a general value and not as a Boolean, is the
|
||||||
|
last evaluated argument.
|
||||||
|
|
||||||
It is possible to assign the result of a comparison or other Boolean
|
It is possible to assign the result of a comparison or other Boolean
|
||||||
expression to a variable. For example,
|
expression to a variable. For example,
|
||||||
|
|
Loading…
Reference in New Issue