From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Tue, 14 Oct 2025 08:21:13 +0000 (+0100) Subject: gh-97914: Reword misleading sentence on conditional expressions (#139064) X-Git-Tag: v3.15.0a1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb25d6b35c7bf9267fd21c809ea095c4ce60b763;p=thirdparty%2FPython%2Fcpython.git gh-97914: Reword misleading sentence on conditional expressions (#139064) Co-authored-by: Gilles Peiffer Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9aca25e3214a..c655d6c52ecc 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 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. 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