[Python-ideas] os.path.join

Devin Jeanpierre jeanpierreda at gmail.com
Mon Nov 4 16:40:20 CET 2013


On Thu, Oct 31, 2013 at 3:30 AM, anatoly techtonik <techtonik at gmail.com> wrote:
> On Wed, Oct 30, 2013 at 8:06 PM, Bruce Leban <bruce at leapyear.org> wrote:
>> I don't know if the code is wrong but if you're asking if the *result* of
>> join is wrong, I don't think it is. It references the same file as these
>> commands:
>>
>> cd /static
>> cat /styles/largestyles,css
>>
>> 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?

Whenever user-provided paths are given relative to another directory,
but you'd like them to be allowed to give an absolute path instead,
the current behaviour is quite convenient. Otherwise, as you say, it
won't come up.

> 2. What is expected result of this operation?

The expected result is the current behaviour. If it helps, I consider
it this way: os.path.join(a, b, c) gives you the directory you'd be in
if you cd into a, b, and c in turn.

-- Devin


More information about the Python-ideas mailing list