https://github.com/python/cpython/commit/63ba8018a17e0c324a96bfc0977e00b76f7491b5 commit: 63ba8018a17e0c324a96bfc0977e00b76f7491b5 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2025-10-14T08:29:16Z summary:
[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]> files: M Doc/reference/expressions.rst diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index d88134b0edbcad..24962c68578cef 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1871,8 +1871,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 _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
