Skip to content

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Nov 2, 2022

match as ...

Fix for issue identified on Discourse:

Before

For "as" in the index, we have:

except clause
import statement
keyword, [1], [2], [3]
with statement

image

https://docs.python.org/3.12/genindex-A.html

There's no "match statement" there.

This is the index entry for the import statement:

.. index::
   ! statement: with
   keyword: as
   single: as; with statement
   single: , (comma); with statement
   single: : (colon); compound statement

This is the index entry for the match statement:

.. index::
   ! statement: match
   ! keyword: case
   ! single: pattern matching
   keyword: if
   keyword: as
   pair: match; case
   single: : (colon); compound statement

After

So let's add single: as; match statement:

except clause
import statement
keyword, [1], [2], [3]
match statement
with statement

image


try ... except as ...

I will note that those keyword links are:

  • keyword itself -> the with statement
  • [1] -> the match statement
  • [2] -> the try statement
  • [3] -> the import statement

To be more explicit, we could also add "try statement" to complete the quartet? It's already covered by "except clause" though.

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Nov 2, 2022
@hugovk hugovk added skip issue needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Nov 2, 2022
@hauntsaninja
Copy link
Contributor

Thanks for fixing!

Maybe the subject of another PR, but I find the "keyword, [1], [2], [3]" phrasing a little confusing: it feels like the keyword link is in a different category than the number links. One possible fix is if we have more than one keyword link, the word "keyword" shouldn't be linked, e.g. "keyword, [1], [2], [3], [4]".

@hugovk
Copy link
Member Author

hugovk commented Nov 2, 2022

That would be something to report to Sphinx.

@JelleZijlstra JelleZijlstra merged commit 26720ff into python:main Nov 3, 2022
@miss-islington
Copy link
Contributor

Thanks @hugovk for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 3, 2022
(cherry picked from commit 26720ff)

Co-authored-by: Hugo van Kemenade <[email protected]>
@bedevere-bot
Copy link

GH-99037 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Nov 3, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 3, 2022
(cherry picked from commit 26720ff)

Co-authored-by: Hugo van Kemenade <[email protected]>
@bedevere-bot
Copy link

GH-99038 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Nov 3, 2022
miss-islington added a commit that referenced this pull request Nov 3, 2022
(cherry picked from commit 26720ff)

Co-authored-by: Hugo van Kemenade <[email protected]>
miss-islington added a commit that referenced this pull request Nov 3, 2022
(cherry picked from commit 26720ff)

Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk hugovk deleted the docs-index-match-as branch November 3, 2022 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants