diff options
author | Daniel F Moisset <dfmoisset@gmail.com> | 2021-03-01 04:08:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 04:08:38 (GMT) |
commit | a22bca6b1e2f3dc11a58f3e5ef5c22e26b8a2d80 (patch) | |
tree | f2b840cbe218ee69d622697fa30b893069151b95 /Doc/faq/design.rst | |
parent | d20279494a3a311c7aefa313174c45d32aa7f5d1 (diff) | |
download | cpython-a22bca6b1e2f3dc11a58f3e5ef5c22e26b8a2d80.zip cpython-a22bca6b1e2f3dc11a58f3e5ef5c22e26b8a2d80.tar.gz cpython-a22bca6b1e2f3dc11a58f3e5ef5c22e26b8a2d80.tar.bz2 |
bpo-42128: Add documentation for pattern matching (PEP 634) (#24664)
This is a first edition, ready to go out with the implementation. We'll iterate during the rest of the period leading up to 3.10.0.
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandt@python.org>
Co-authored-by: Raymond Hettinger <1623689+rhettinger@users.noreply.github.com>
Co-authored-by: Guido van Rossum <guido@python.org>
Diffstat (limited to 'Doc/faq/design.rst')
-rw-r--r-- | Doc/faq/design.rst | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 8cf271c..7fe1c6d 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -259,9 +259,8 @@ Why isn't there a switch or case statement in Python? ----------------------------------------------------- You can do this easily enough with a sequence of ``if... elif... elif... else``. -There have been some proposals for switch statement syntax, but there is no -consensus (yet) on whether and how to do range tests. See :pep:`275` for -complete details and the current status. +For literal values, or constants within a namespace, you can also use a +``match ... case`` statement. For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For |