[Python-ideas] os.path.join

Chris Angelico rosuav at gmail.com
Mon Nov 4 17:17:18 CET 2013

Blargh, wrong list. It should have been private anyway. Kindly take no
notice of the man behind the 3AM clock...


On Tue, Nov 5, 2013 at 3:07 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Nov 5, 2013 at 2:29 AM, anatoly techtonik <techtonik at gmail.com> wrote:
>> Right. But I am working more with URL paths nowadays. In there if I
>> want to join two paths, no matter if 2nd starts with slash or not, I
>> don't really expect the 2nd to rewrite the first.
> Then os.path.join is probably the wrong tool for the job. Do you want
> to collapse "/foo/bar" + "../quux" into "/foo/quux"? That rewrites the
> first. If not, don't use a function that does that. Try simple string
> concatenation instead.
> ChrisA

More information about the Python-list mailing list