This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Is the return value of pathlib.Path.glob() sorted?
Type: enhancement Stage:
Components: Documentation Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Björn.Lindqvist, brett.cannon, docs@python, serhiy.storchaka, xtreak
Priority: normal Keywords:

Created on 2020-02-06 16:00 by Björn.Lindqvist, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg361494 - (view) Author: Björn Lindqvist (Björn.Lindqvist) Date: 2020-02-06 16:00
It would be great if the docs were clearer on what you can assume on the ordering of pathlib.Path.glob() calls. Is it sorted? Is it the same in consecutive calls? I'm guessing you can't assume anything at all, which I think should be clarified in the docs.
msg361496 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-06 16:58
See also discussion at issue38764. I guess it's not sorted as per msg356356.
msg361500 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-02-06 18:24
The problem is you would have to say the same thing for all functions that return a list or touch the file system. So it's typically better to just assume unsorted and you can't expect idempotent results when dealing with the OS.
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83750
2020-02-06 18:24:31brett.cannonsetnosy: + brett.cannon
messages: + msg361500
2020-02-06 16:58:56xtreaksetnosy: + xtreak, serhiy.storchaka
messages: + msg361496
2020-02-06 16:00:25Björn.Lindqvistcreate