]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-97914: Reword misleading sentence on conditional expressions (GH-139064...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 14 Oct 2025 08:28:12 +0000 (10:28 +0200)
committerGitHub <noreply@github.com>
Tue, 14 Oct 2025 08:28:12 +0000 (08:28 +0000)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Gilles Peiffer <gilles.peiffer.yt@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/reference/expressions.rst

index 9aca25e3214a16497b8933760541c1d73a53fabc..c655d6c52ecc1622b40e1e85a0e7d78725744f96 100644 (file)
@@ -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