Skip to content

gh-111307 Updating match..case in design documentation #111312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

dascritch
Copy link

@dascritch dascritch commented Oct 25, 2023

The documentation still recommended not accurate way to do Structural Pattern Matching (aka switch case), and was not up to date as this feature is included in Python 3.10

As suggested, I try to upgrade it
#111307 (comment)


📚 Documentation preview 📚: https://cpython-previews--111312.org.readthedocs.build/

The documentation still recommended not accurate way to do Structural Pattern Matching (aka `switch case`), and was not up to date as this feature is included in Python 3.10

As suggested, I try to upgrade it 
python#111307 (comment)
@ghost
Copy link

ghost commented Oct 25, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 25, 2023
@Eclips4 Eclips4 changed the title gn-111307 Updating match..case in design documentation gh-111307 Updating match..case in design documentation Oct 25, 2023
Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing wrong with if ... elif .... The raison d'etre of structural pattern matching is more about destructuring complex objects than it is providing a switch statement. I'd recommend keeping the previous text as it was, and simply adding an example of a match ... case statement after the first paragraph

@pochmann
Copy link
Contributor

pochmann commented Oct 28, 2023

Why do you want to remove the dictionary and getattr solutions?

@terryjreedy
Copy link
Member

I explained on the issue why I think deleting the existing options is a mistake. Closing this PR which does that.
PR #115899 lightly revises the existing entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants