[issue33275] glob.glob should explicitly note that results aren't sorted

Eryk Sun report at bugs.python.org
Wed Apr 25 11:47:39 EDT 2018


Eryk Sun <eryksun at gmail.com> added the comment:

As I said, some file systems such as NTFS and ISO 9660 (or Joliet) store directories in lexicographically sorted order. NTFS does this using a b-tree and case-insensitive comparison, which helps the driver efficiently implement filtering a directory listing using a pattern such as "spam*eggs?.txt". (Filtering of a directory listing at the syscall level is peculiar to Windows and not supported by Python.)

I like the phrase "arbitrary order". I don't think it's wise for an application to ever depend on the order. Also, we usually want natural-language collation for display purposes (e.g. spam2.txt should come before spam10.txt), so we have to sort the result regardless of the file system.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33275>
_______________________________________


More information about the Python-bugs-list mailing list