New submission from Ben FrantzDale <>:

The sortedness of glob.glob's output is platform-dependent. While the docs do 
not mention sorting, and so are strictly correct, if you are on a platform 
where its output is sorted, it's easy to believe that the output is always 

I propose we a Note maybe next to "Note: Using the “**” pattern in large 
directory trees may consume an inordinate amount of time." that says "Note: 
While the output of glob.glob may be sorted on some architectures, ordering is 
not guaranteed. Use `sort(glob.glob(...))` if ordering is important."

This wrong assumption burned us when scripts inexplicably stopped working on 
OSX High Sierra.

components: Library (Lib)
messages: 315254
nosy: Ben FrantzDale
priority: normal
severity: normal
status: open
title: glob.glob should explicitly note that results aren't sorted
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

Python tracker <>
Python-bugs-list mailing list

Reply via email to