[issue32040] Sorting pahtlib.Paths does give the same order as sorting the (string) filenames of that pathlib.Paths

Serhiy Storchaka report at bugs.python.org
Wed Nov 15 15:09:37 EST 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Paths are ordered by lexicographical order of their corresponding components. Paths are not strings, and this this order is more natural for them.

The alphabetical order of Path strings:

    SPAMS.txt
    SPAM\file.txt

    spam\file.txt
    spams.txt

    spam-file.txt
    spam/file.txt
    spam_file.txt

The lexicographical order of Path components:

    SPAM\file.txt
    SPAMS.txt

    spam\file.txt
    spams.txt

    spam/file.txt
    spam-file.txt
    spam_file.txt

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug

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


More information about the Python-bugs-list mailing list