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 akima, eryksun, pitrou, steve.dower
Date 2014-09-05.17:16:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409937417.18.0.261922593267.issue22302@psf.upfronthosting.co.za>
In-reply-to
Content
My experience says the main reason people want to know whether the path is absolute is to figure out whether to do `Path.cwd() / path` or not. According to that MSDN page, they shouldn't because the path starts with "//" (that is, the last character and the existence of the share name are irrelevant here).

Both pathlib and ntpath are reasonably consistent in determining the "drive" of the path:
>>> splitdrive('\\\\server\\')[0]
'\\\\server\\'
>>> splitdrive('\\\\server')[0]
''
>>> Path('\\\\server\\').parts[0]
'\\\\server\\\\'
>>> Path('\\\\server').parts[0]
'\\'

I assume the bug in the last statement is what Antoine is referring to.

The difference in results then comes from how they determine roots.
>>> splitdrive('\\\\server\\')[1]
''
>>> splitdrive('\\\\server')[1]
'\\\\server'
>>> Path('//server/').root
'\\'
>>> Path('//server').root
'\\'

Pathlib always has a root, but splitdrive doesn't.

I'm not sure exactly which one to fix where, but hopefully that helps someone else figure it out.
History
Date User Action Args
2014-09-05 17:16:57steve.dowersetrecipients: + steve.dower, pitrou, eryksun, akima
2014-09-05 17:16:57steve.dowersetmessageid: <1409937417.18.0.261922593267.issue22302@psf.upfronthosting.co.za>
2014-09-05 17:16:57steve.dowerlinkissue22302 messages
2014-09-05 17:16:56steve.dowercreate