Link to data model docs in slice's glossary/built-in doc entry#140070
Open
Jackenmen wants to merge 3 commits intopython:mainfrom
Open
Link to data model docs in slice's glossary/built-in doc entry#140070Jackenmen wants to merge 3 commits intopython:mainfrom
Jackenmen wants to merge 3 commits intopython:mainfrom
Conversation
| when several are given, such as in ``variable_name[1:3:5]``. The bracket | ||
| (subscript) notation uses :class:`slice` objects internally. | ||
|
|
||
| See also :ref:`slice-objects`. |
Member
There was a problem hiding this comment.
When I click the rendered link in the preview, it sends me to the C-API docs and not the data model docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
slicelink, 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
sliceis listed in the Built-in Types document and links to "The standard type hierarchy" part of the Data model docs, 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 howstaticmethoddocumentation in "Built-in Functions" links to "The standard type hierarchy" section.I guess, it's not ideal that the
slicedocumentation is spread across "Built-in Functions" (where thestart,stop, andstepattributes are listed with.. attribute::, though not really documented) and "Data model" (where theslice.indicesmethod 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.
📚 Documentation preview 📚: https://cpython-previews--140070.org.readthedocs.build/