-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
docs: be clearer that glob results are unordered #140184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| .. note:: | ||
| The pathnames are returned in no particular order. If you need a specific | ||
| order, sort the results. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already "although results are returned in arbitrary order" in the paragraph above. Can you remove that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s ok to repeat the point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already repeated twice:
"although results are returned in arbitrary order." (9f3c094)
"Whether or not the results are sorted depends on the file system." (52465e1)
The note directive is used to highlight non-obvious details that may require additional attention from the user. If you think this is the case, then this directive should also be used for os.listdir() and os,scandir().
| .. note:: | ||
| The pathnames are returned in no particular order. If you need a specific | ||
| order, sort the results. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s ok to repeat the point.
|
Please don’t. Docs already say order is file system dependent. Brevity is inherently valuable. |
a46210d to
56cd062
Compare
56cd062 to
df78ded
Compare
|
I've tweaked the initial paragraph, including removing the mention of order, to let the Note handle it instead. |
|
I think saying it once, in a note, at the module level and again for each function (not as a note) is about right. LGTM. |
|
Thanks @nedbat for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
* docs: be clearer that glob results are unordered * trim down the opening paragraph (cherry picked from commit ed672f7) Co-authored-by: Ned Batchelder <[email protected]>
* docs: be clearer that glob results are unordered * trim down the opening paragraph (cherry picked from commit ed672f7) Co-authored-by: Ned Batchelder <[email protected]>
|
GH-140339 is a backport of this pull request to the 3.14 branch. |
|
GH-140340 is a backport of this pull request to the 3.13 branch. |
…140339) (cherry picked from commit ed672f7) Co-authored-by: Ned Batchelder <[email protected]>
…140340) (cherry picked from commit ed672f7) Co-authored-by: Ned Batchelder <[email protected]>
From this dpo discussion: https://discuss.python.org/t/should-glob-glob-output-be-stable/104385
📚 Documentation preview 📚: https://cpython-previews--140184.org.readthedocs.build/