[Python-ideas] os.path.join

Bruce Leban bruce at leapyear.org
Sun Nov 3 07:32:27 CET 2013


On Sat, Nov 2, 2013 at 8:12 PM, Ryan Hiebert <ryan at ryanhiebert.com> wrote:

> IIRC correctly the form 'd:efg' refers to a relative path on the d:
> drive, based on the current working directory _of that drive_.
>

Correct


> Since
> it requires a default base path to be relative on, that form wouldn't
> work cross drives.
>

os.path.join doesn't require a full base path and isn't required to return
an absolute path.


> However if we used the same drive, we might be
> willing to allow a relative path prefixed with a  drive letter.
>
> os.path.join(r'c:\abc\foo', 'd:efg') # ERROR
>

This shouldn't be an error. The correct result is 'd:efg', i.e., relative
to the current path on the D drive at the time the path is used, just as
'\abc' is relative to the current drive at the time the path is used.


--- Bruce
I'm hiring: http://www.cadencemd.com/info/jobs
Latest blog post: Alice's Puzzle Page http://www.vroospeak.com
Learn how hackers think: http://j.mp/gruyere-security
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131102/d2846423/attachment.html>


More information about the Python-ideas mailing list