Skip to content

gh-133510: Add links to more info for the match statement #133511

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

xzkdeng
Copy link

@xzkdeng xzkdeng commented May 6, 2025

Add example of the match statement in the FAQ "Why isn't there a switch or case statement in Python?", and links to PEP 634,PEP 636 for details.


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

Add example of the ``match`` statement in the FAQ "Why isn't there a switch or case statement in Python?", and links to PEP 634,PEP 636 for details.
@python-cla-bot
Copy link

python-cla-bot bot commented May 6, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@xzkdeng xzkdeng changed the title gh-133510: Add example for the match statement gh-133510: Add links to more info for the match statement May 6, 2025
Since Python 3.10 one can easily match literal values, or constants
within a namespace, with a ``match ... case`` statement.
See :pep:`634` (specification) and :pep:`636` (tutorial) for details about the ``match`` statement.
Copy link
Member

Choose a reason for hiding this comment

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

For the "(tutorial)" it is probably best to replace the link with a link to the actual tutorial page that covers this.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. The PEPs are historical documents that typically become stale over time. I think that there shouldn't be a link to a PEP for either the specification or tutorial.

Copy link
Author

Choose a reason for hiding this comment

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

So we should add an 'outdated' note in PEP 636, like the one in PEP 634.

Since Python 3.10 one can easily match literal values, or constants
within a namespace, with a ``match ... case`` statement.
See :pep:`634` (specification) and :pep:`636` (tutorial) for details about
Copy link
Member

Choose a reason for hiding this comment

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

Please link to the documentation too here.

Copy link
Author

Choose a reason for hiding this comment

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

Did you mean adding a link to this?

@bedevere-app
Copy link

bedevere-app bot commented May 7, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

xzkdeng and others added 2 commits May 9, 2025 18:51
Changed the links to link to more up-to-date documentation.
@xzkdeng
Copy link
Author

xzkdeng commented May 9, 2025

I have made the requested changes; please review again
Suggestions are welcomed!

@bedevere-app
Copy link

bedevere-app bot commented May 9, 2025

Thanks for making the requested changes!

@AA-Turner: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from AA-Turner May 9, 2025 11:15
@xzkdeng xzkdeng reopened this May 9, 2025
@xzkdeng
Copy link
Author

xzkdeng commented May 9, 2025

Accidentally clicked the "close with comment" button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants