[Python-ideas] os.path.join

Georg Brandl g.brandl at gmx.net
Thu Oct 31 17:06:01 CET 2013


Am 31.10.2013 13:56, schrieb Paul Moore:
> On 31 October 2013 10:30, anatoly techtonik <techtonik at gmail.com> wrote:
>>> I agree it might be confusing but it's pretty explicitly documented.
>>
>> Yes. It is confusing.
>>
>> 1. How often the operations to join absolute paths is needed?
> 
> Infrequently, but occasionally. Usually the first argument will be a
> fixed value which is a "base path" and the second will be a
> user-supplied (or similar) value which is to be interpreted as
> relative to the base, unless it's an absolute path when it's to be
> used unchanged.

Exactly.  Absolute paths are different from relative paths, and it should
be made clear to everyone quite early that "foo" is different from "/foo".

I hope nobody would expect path.join('C:\\xyz', 'D:\\abc') to result in
'C:\\xyz\\D:\\abc' on Windows.

Georg



More information about the Python-ideas mailing list