On 6 October 2012 11:09, Stephen J. Turnbull
Antoine Pitrou writes:
``relative()`` returns a new relative path by stripping the drive and root::
Does this have use cases so common that it deserves a convenience method?
Agreed.
I would expect "relative" to require an argument. (Ie, I would expect it to have the semantics of "relative_to".)
I agree that's what I thought relative() would be when I first read the name.
Or is the issue that you can't count on PureNTPath(p).relative_to('C:\\') to DTRT?
It seems to me that if p isn't on drive C:, then the right thing is clearly to raise an exception. No ambiguity there - although Unix users might well write code that doesn't allow for exceptions from the method, just because it's not a possible result on Unix. Having it documented might help raise awareness of the possibility, though. And that's about the best you can hope for. Paul.