Skip to content

Commit 63ba801

Browse files
miss-islingtoniritkatrielPeiffapAA-Turner
authored
[3.13] gh-97914: Reword misleading sentence on conditional expressions (GH-139064) (#140094)
Co-authored-by: Irit Katriel <[email protected]> Co-authored-by: Gilles Peiffer <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent eec807a commit 63ba801

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Doc/reference/expressions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,9 @@ Conditional expressions
18711871
conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
18721872
expression: `conditional_expression` | `lambda_expr`
18731873

1874-
Conditional expressions (sometimes called a "ternary operator") have the lowest
1875-
priority of all Python operations.
1874+
A conditional expression (sometimes called a "ternary operator") is an
1875+
alternative to the if-else statement. As it is an expression, it returns a value
1876+
and can appear as a sub-expression.
18761877

18771878
The expression ``x if C else y`` first evaluates the condition, *C* rather than *x*.
18781879
If *C* is true, *x* is evaluated and its value is returned; otherwise, *y* is

0 commit comments

Comments
 (0)