gh-133510: Add links to more info for the match statement#133511
gh-133510: Add links to more info for the match statement#133511xzkdeng wants to merge 7 commits intopython:mainfrom
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. |
| See `the specification <https://docs.python.org/3/reference/compound_stmts.html#the-match-statement>`_ and `the tutorial <https://docs.python.org/3/tutorial/controlflow.html#match-statements>`_ for details about | ||
| the :keyword:`match` statement. |
There was a problem hiding this comment.
Please use :ref: directives and wrap to 79 characters.
| See `the specification <https://docs.python.org/3/reference/compound_stmts.html#the-match-statement>`_ and `the tutorial <https://docs.python.org/3/tutorial/controlflow.html#match-statements>`_ for details about | |
| the :keyword:`match` statement. | |
| See :ref:`the specification <match>` and :ref:`the tutorial <tut-match>` | |
| for details about the :keyword:`match` statement. |
|
This PR is stale because it has been open for 30 days with no activity. |
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/