Skip to content

Commit 1b5db5a

Browse files
authored
pythonGH-130153: Reword the wildcard matching part of the tutorial (pythonGH-129954)
1 parent ba05a4e commit 1b5db5a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Doc/tutorial/controlflow.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ similar to a switch statement in C, Java or JavaScript (and many
289289
other languages), but it's more similar to pattern matching in
290290
languages like Rust or Haskell. Only the first pattern that matches
291291
gets executed and it can also extract components (sequence elements
292-
or object attributes) from the value into variables.
292+
or object attributes) from the value into variables. If no case matches,
293+
none of the branches is executed.
293294

294295
The simplest form compares a subject value against one or more literals::
295296

@@ -305,7 +306,7 @@ The simplest form compares a subject value against one or more literals::
305306
return "Something's wrong with the internet"
306307

307308
Note the last block: the "variable name" ``_`` acts as a *wildcard* and
308-
never fails to match. If no case matches, none of the branches is executed.
309+
never fails to match.
309310

310311
You can combine several literals in a single pattern using ``|`` ("or")::
311312

0 commit comments

Comments
 (0)