-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Documentation
Describe the bug
I did a search to remember what was the switch keyword in Python, and the very first link I got is a not up-to-date page from Python 3.11 documentation, explaining that elif is great.
To Reproduce
Steps to reproduce the behavior:
- Go to https://docs.python.org/3.12/faq/design.html
- Click on Why isn’t there a switch or case statement in Python?
match caseisn't cited, but the catastrophicelifcascade is still the “reference”
Expected behavior
Correct it and explain why match case is a really better coding practice instead of cascaded elif (unreadable, unmaintainable, confuse)
Sidenote :
Found here what I was looking at.
Even on this not related page the author use return, and didn't think to replace elif with simplier if !
Linked PRs
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir