Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 6 Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ The match statement is used for pattern matching. Syntax:

.. productionlist:: python-grammar
match_stmt: 'match' `subject_expr` ":" NEWLINE INDENT `case_block`+ DEDENT
subject_expr: `!star_named_expression` "," `!star_named_expressions`?
: | `!named_expression`
subject_expr: `flexible_expression` "," [`flexible_expression_list` [',']]
: | `assignment_expression`
case_block: 'case' `patterns` [`guard`] ":" `!block`

.. note::
Expand Down Expand Up @@ -702,7 +702,7 @@ Guards
.. index:: ! guard

.. productionlist:: python-grammar
guard: "if" `!named_expression`
guard: "if" `assignment_expression`

A ``guard`` (which is part of the ``case``) must succeed for code inside
the ``case`` block to execute. It takes the form: :keyword:`if` followed by an
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.