Skip to content

Link to data model docs in slice's glossary/built-in doc entry - #159552

Open
Jackenmen wants to merge 4 commits into
python:mainfrom
Jackenmen:patch-1
Open

Jackenmen wants to merge 4 commits into
python:mainfrom
Jackenmen:patch-1

Conversation

@Jackenmen

Copy link
Copy Markdown
Contributor

Note: this is recreation of #140070 whose review I completely missed until the PR got closed and then, since it was already closed, it waited on my TODO list for a while, sorry for that!
The review comment from the original PR has been addressed by renaming C API docs' slice-objects anchor to c-api-slice-objects. This seems consistent with at least some of the other anchor names used in C API docs + that anchor was not used at all anyway.

Below is the description copied from #140070 pretty much as is.

Story time!

With the way the documentation is currently organised, I expect to find information about built-in functions/types on the Built-in Functions page.
Sure enough, slice() is on that list, and it starts as follows: "Returns a :term:`slice` object".
Since I needed more information than was already provided, I clicked on the slice link, which directed me to the glossary. Information there, however, still did not include the more detailed information that I was looking for. The glossary entry has a :class:`slice` link, but that just links back to Built-in Functions.

So, that's how this PR came about - I eventually found that slice is listed in the Built-in Types document and links to "The standard type hierarchy" part of the Data model docs (the actual "slice object" was not a ref so I updated that in this PR too), where I found the remaining pieces of information. I think it makes sense to add "See also" links to the function and probably glossary as well. This is similar to how staticmethod documentation in "Built-in Functions" links to "The standard type hierarchy" section.

I guess, it's not ideal that the slice documentation is spread across "Built-in Functions" (where the start, stop, and step attributes are listed with .. attribute::, though not really documented) and "Data model" (where the slice.indices method is documented + aforementioned attributes are better documented and :ref:ed) but I wanted to at least make it easy to find the information through links.

I did not make an issue since this seems like a trivial docs enhancement, but please let me know if I should do so.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35196352 | 📁 Comparing 99a3f7e against main (d3ada45)

  🔍 Preview build  

3 files changed
± glossary.html
± builtins/functions.html
± builtins/stdtypes.html

@Jackenmen

Copy link
Copy Markdown
Contributor Author

Since the time I experienced the described story, slice has actually become generic at runtime so there are now 2 things only available in the "Slice objects" section of the data model page - slice.indices() and the new information about slice type supporting subscription :)

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

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant