Skip to content

Commit 0c9b4ca

Browse files
committed
gh-97914: [doc] reword misleading sentence on conditional expressions
1 parent 77a22ef commit 0c9b4ca

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
@@ -1938,8 +1938,9 @@ Conditional expressions
19381938
conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
19391939
expression: `conditional_expression` | `lambda_expr`
19401940

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

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

0 commit comments

Comments
 (0)