This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steve.dower
Recipients benrg, paul.moore, steve.dower, tim.golden, zach.ware
Date 2018-01-23.07:27:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516692421.3.0.467229070634.issue32612@psf.upfronthosting.co.za>
In-reply-to
Content
Arguably, a WindowsPath instance only represents the *path* and not the file located by the path. So the programmer has to take just as much responsibility as if they were using plain strings, except there are some conveniences added to make those strings easier to manage.

I don't see anything in the docs suggesting that a Path instances have file-identity (that is, two Path objects are always equal if they refer to the same file). Even the "resolve()" method doesn't pretend to get the exact filename.

The best option for true comparison is to use stat() and compare st_inode and st_dev. Lacking that, doing a good enough job of case folding is better than ignoring it, as most workarounds are likely to do a worse job (e.g., they won't even correct for "A"=="B\..\A", let alone casing).

If you have a specific suggestion for how comparison could be improved here without having to go to kernel mode, feel free to make it. Unfortunately, your two suggestions here are not workable.

(And yes, PurePosixPath and "import posixpath" are the right way to handle case-sensitive paths explicitly, which is why they're available on all platforms.)
History
Date User Action Args
2018-01-23 07:27:01steve.dowersetrecipients: + steve.dower, paul.moore, tim.golden, benrg, zach.ware
2018-01-23 07:27:01steve.dowersetmessageid: <1516692421.3.0.467229070634.issue32612@psf.upfronthosting.co.za>
2018-01-23 07:27:01steve.dowerlinkissue32612 messages
2018-01-23 07:27:00steve.dowercreate