From 0c9b4ca3c9e007a76d1ec87bec8d678190d783e4 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 17 Sep 2025 17:00:59 +0100 Subject: [PATCH 1/2] gh-97914: [doc] reword misleading sentence on conditional expressions --- Doc/reference/expressions.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9aca25e3214a16..ed62e68f00db17 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1938,8 +1938,9 @@ Conditional expressions conditional_expression: `or_test` ["if" `or_test` "else" `expression`] expression: `conditional_expression` | `lambda_expr` -Conditional expressions (sometimes called a "ternary operator") have the lowest -priority of all Python operations. +A conditional expressions (sometimes called a "ternary operator") is an +alternative to the if-else statement. As it is an expression, it returns a value +and can appear as a sub-expression. The expression ``x if C else y`` first evaluates the condition, *C* rather than *x*. If *C* is true, *x* is evaluated and its value is returned; otherwise, *y* is From f6002079be768afcac841fd18fcb13dc748b9c17 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:28:43 +0100 Subject: [PATCH 2/2] Update Doc/reference/expressions.rst Co-authored-by: Gilles Peiffer --- Doc/reference/expressions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index ed62e68f00db17..c655d6c52ecc16 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1938,7 +1938,7 @@ Conditional expressions conditional_expression: `or_test` ["if" `or_test` "else" `expression`] expression: `conditional_expression` | `lambda_expr` -A conditional expressions (sometimes called a "ternary operator") is an +A conditional expression (sometimes called a "ternary operator") is an alternative to the if-else statement. As it is an expression, it returns a value and can appear as a sub-expression.