Author brandtbucher
Recipients brandtbucher, njs
Date 2019-11-11.02:31:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573439465.82.0.454532301834.issue38764@roundup.psfhosted.org>
In-reply-to
Content
This has been discussed before, but we now have examples in the news of glob's non-deterministic behavior causing some real headaches for hundreds of people in the scientific community. After some cursory discussion (https://discuss.python.org/t/a-code-glitch-may-have-caused-errors-in-more-than-100-published-studies/2583) it was suggested that this issue would at least be worth revisiting, given the damage... bad programming practices aside.

The attached patch guarantees glob/iglob traversal order across all platforms, and modifies all of the existing tests to check for this.

One reason this was rejected twice before (in both issue 21748, four years ago, and issue 30461, two years ago) was the argument that the user could always just call "sorted" on the returned list if they wanted ordered results. Aside from losing the laziness of iglob, this solution also loses the traversal order, since recursive globs use a breadth-first search. In the attached patch, iglob is still just as lazy as ever, and the traversal is unchanged for anyone using a platform that already returns sorted results.
History
Date User Action Args
2019-11-11 02:31:05brandtbuchersetrecipients: + brandtbucher, njs
2019-11-11 02:31:05brandtbuchersetmessageid: <1573439465.82.0.454532301834.issue38764@roundup.psfhosted.org>
2019-11-11 02:31:05brandtbucherlinkissue38764 messages
2019-11-11 02:31:05brandtbuchercreate