Eryk Sun <eryk...@gmail.com> added the comment:

> Right now PureWindowsPath does probably something like NTFS sorting, 
> but NTFS is not Windows and from a function called 'WindowsPath' I 
> expect a path that would be given in Windows Explorer.

NTFS stores the names in a directory as a btree that's sorted 
case-insensitively according to the filesystem's casing table. Other 
filesystems such as FAT32 store names in arbitrary order, maybe FIFO order with 
reuse of slot indexes when files are deleted, or maybe based on hashing the 
filename.

The Windows file API does not sort the results of a directory listing. It's up 
to applications to decide how a listing will be presented. You cite what 
Explorer does as a standard for "Windows", but there is no such standard that I 
know of. Maybe implementing a natural sort for Path instances is desirable, but 
I disagree that appealing to what Explorer does should be the sole basis for 
this decision. Anyway, it would be a breaking change, which certainly cannot be 
implemented in 3.8.

Currently sorting is based on the case-folded parts:

     def casefold_parts(self, parts):
        return [p.lower() for p in parts]

----------
nosy: +eryksun
versions: +Python 3.9 -Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39544>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to