From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 14 Dec 2021 15:25:32 +0000 (-0800) Subject: bpo-46059: Clarify pattern-matching example in "control flow" docs (GH-30079) X-Git-Tag: v3.10.2~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=503803d8c19be91becc09ca59f3febcbc324d6d2;p=thirdparty%2FPython%2Fcpython.git bpo-46059: Clarify pattern-matching example in "control flow" docs (GH-30079) The "Color" example in the pattern-matching section of the "control flow" documentation is not immediately runnable, leading to confusion. Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> (cherry picked from commit 1cbb88736c32ac30fd530371adf53fe7554be0a5) Co-authored-by: Alex Waygood --- diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index a81975660261..fad874601464 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -395,9 +395,11 @@ Several other key features of this statement: from enum import Enum class Color(Enum): - RED = 0 - GREEN = 1 - BLUE = 2 + RED = 'red' + GREEN = 'green' + BLUE = 'blue' + + color = Color(input("Enter your choice of 'red', 'blue' or 'green': ")) match color: case Color.RED: