Skip to content

Conversation

@nedbat
Copy link
Member

@nedbat nedbat commented Oct 16, 2025

Comment on lines +28 to +31
.. note::
The pathnames are returned in no particular order. If you need a specific
order, sort the results.

Copy link
Contributor

@nineteendo nineteendo Oct 16, 2025

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?

Copy link
Member

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.

Copy link
Member

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().

Comment on lines +28 to +31
.. note::
The pathnames are returned in no particular order. If you need a specific
order, sort the results.

Copy link
Member

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.

@Gerardwx
Copy link
Contributor

Please don’t. Docs already say order is file system dependent. Brevity is inherently valuable.

@nedbat nedbat force-pushed the nedbat/glob-no-order branch 2 times, most recently from a46210d to 56cd062 Compare October 19, 2025 11:58
@nedbat nedbat force-pushed the nedbat/glob-no-order branch from 56cd062 to df78ded Compare October 19, 2025 12:12
@nedbat
Copy link
Member Author

nedbat commented Oct 19, 2025

I've tweaked the initial paragraph, including removing the mention of order, to let the Note handle it instead.

@hugovk hugovk added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Oct 19, 2025
@terryjreedy
Copy link
Member

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.

@nedbat nedbat merged commit ed672f7 into python:main Oct 19, 2025
49 checks passed
@miss-islington-app
Copy link

Thanks @nedbat for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@nedbat nedbat deleted the nedbat/glob-no-order branch October 19, 2025 20:16
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 19, 2025
* 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]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 19, 2025
* 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]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 19, 2025

GH-140339 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Oct 19, 2025
@bedevere-app
Copy link

bedevere-app bot commented Oct 19, 2025

GH-140340 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 19, 2025
hugovk pushed a commit that referenced this pull request Oct 20, 2025
hugovk pushed a commit that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants