[rb-general] patching python glob

Peter Stuge peter at stuge.se
Wed May 24 11:10:06 CEST 2017

Bernhard M. Wiedemann wrote:
> I am thinking to propose to python upstream
> make every call of glob.glob deliver (reproducible) sorted output.
> What do you think?

I think there is merit to the goal but am unsure if that approach is
the best way.

glob() is POSIX so in libc and not only in Python.

Why not look at libc to begin with?

--8<-- glob(3)
The  argument  flags  is  made up of the bitwise OR of zero or more the
following symbolic constants, which modify the behavior of glob():

       Don't sort the returned pathnames.  The only reason to  do  this
       is  to save processing time.  By default, the returned pathnames
       are sorted.

So the default for glob() *is* to sort. Doesn't Python use the default
when calling glob()? I do think it would make sense to use the default
also by default in Python.


More information about the rb-general mailing list