gh-133510: Add links to more info for the match statement#133511
Conversation
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.
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
|
|
||
| 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. |
There was a problem hiding this comment.
For the "(tutorial)" it is probably best to replace the link with a link to the actual tutorial page that covers this.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
So we should add an 'outdated' note in PEP 636, like the one in PEP 634.
Co-authored-by: sobolevn <mail@sobolevn.me>
|
|
||
| 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 |
There was a problem hiding this comment.
Please link to the documentation too here.
|
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 |
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Changed the links to link to more up-to-date documentation.
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @AA-Turner: please review the changes made to this pull request. |
|
Accidentally clicked the "close with comment" button. |
|
This PR is stale because it has been open for 30 days with no activity. |
Documentation build overview
|
|
Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-152654 is a backport of this pull request to the 3.13 branch. |
|
GH-152655 is a backport of this pull request to the 3.14 branch. |
|
GH-152656 is a backport of this pull request to the 3.15 branch. |
…AQ anwser (GH-133511) (#152654) (cherry picked from commit 7718157) Co-authored-by: xzkdeng <xzkdeng@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Stan Ulbrych <stan@python.org>
…AQ anwser (GH-133511) (#152655) (cherry picked from commit 7718157) Co-authored-by: xzkdeng <xzkdeng@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Stan Ulbrych <stan@python.org>
…AQ anwser (GH-133511) (#152656) (cherry picked from commit 7718157) Co-authored-by: xzkdeng <xzkdeng@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Stan Ulbrych <stan@python.org>
Add example of the
matchstatement 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/