Skip to content

Improve the doc for Conditional Expressions #97914

@Mariatta

Description

@Mariatta

Documentation

Initially reported in docs mailing list by Denilson Sá Maia

https://mail.python.org/archives/list/[email protected]/thread/NZTUNIYEZVY2WOF3GH6TAZ32OLMKR3QO/

https://docs.python.org/3.10/reference/expressions.html

At section 6.13, it says: “Conditional expressions (sometimes called a
“ternary operator”) have the lowest priority of all Python
operations.”

However, further down below in the "6.17. Operator precedence"
section, the if-else expression has higher precedence than both lambda
and walrus. Maybe those two are not technically "operations", but
since they are under operator precedence, they are operations.

It's confusing, and it's a minor detail, but still worth fixing.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions