FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-110383: Add documentation entry for `sorted(d)` by shenanigansd · Pull Request #112777 · python/cpython · GitHub

/ cpython Public

gh-110383: Add documentation entry for sorted(d) - #112777

Closed
shenanigansd wants to merge 2 commits into
python:mainfrom
shenanigansd:patch-1
Closed

gh-110383: Add documentation entry for sorted(d)#112777
shenanigansd wants to merge 2 commits into
python:mainfrom
shenanigansd:patch-1

Conversation

shenanigansd commented Dec 5, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

Continues #110383
Originally reported in https://mail.python.org/archives/list/docs@python.org/thread/ZEDPZHRVGLYR4ZFZ5I3NBWVMHMX4WPGW/ (3rd list item)

Add a documentation entry for sorted(d) to clarify that it returns the sorted keys and not the dict itself.


📚 Documentation preview 📚: https://cpython-previews--112777.org.readthedocs.build/

bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Dec 5, 2023

Copy link
Copy Markdown
Contributor

Thank for you the suggestion but we should decline. Mostly, we try to avoid this kind of tight coupling of documentation between different parts of the language. Tools like sorted, reversed, and enumerate are ways that any iterable (or sequence) can be returned. There is nothing specific to dictionaries.

If this comes up again, we could consider an FAQ entry or an addition to the looping idioms section of the tutorial, but this edit to the detailed spec for dicts is the wrong place to do it (and not at all discoverable by beginners).

One other thought is that this hasn't come up before and the underlying report wasn't from a beginner; instead, it was an unsubstantiated suggestion that somewhere someone might someday have a moment of confusion.

rhettinger closed this Dec 16, 2023
shenanigansd deleted the patch-1 branch December 16, 2023 21:17
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

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL