Link to existing rules in compound_stmts.rst (GH-149811) · python/cpython@c375292

GitHub

Original file line numberDiff line numberDiff line change@@ -618,8 +618,8 @@ The match statement is used for pattern matching. Syntax:

618618619619.. productionlist:: python-grammar

620620 match_stmt: 'match' `subject_expr` ":" NEWLINE INDENT `case_block`+ DEDENT

621- subject_expr: `!star_named_expression` "," `!star_named_expressions`?

622- : | `!named_expression`

621+ subject_expr: `flexible_expression` "," [`flexible_expression_list` [',']]

622+ : | `assignment_expression`

623623 case_block: 'case' `patterns` [`guard`] ":" `!block`

624624625625.. note::

@@ -709,7 +709,7 @@ Guards

709709.. index:: ! guard

710710711711.. productionlist:: python-grammar

712- guard: "if" `!named_expression`

712+ guard: "if" `assignment_expression`

713713714714A ``guard`` (which is part of the ``case``) must succeed for code inside

715715the ``case`` block to execute. It takes the form: :keyword:`if` followed by an