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>
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index a819756..fad8746 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -395,9 +395,11 @@
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: