os.join --

Fredrik Lundh fredrik at pythonware.com
Sun May 13 05:09:58 EDT 2001

Matthew Turk wrote:
> Hi all.  I've just got a quick question --
> When Python 2.0 was released, one of the big changes was the fact that
> the append method for lists no longer took an unlimited list of items.
> Why does os.join not follow this?

maybe because join is and has always been documented to take an
unlimited list of items?

    join(path1[, path2[, ...]])

        Joins one or more path components intelligently. If any
        component is an absolute path, all previous components
        are thrown away, and joining continues.

> And why was append changed in the first place?  (But more importantly,
> I wanna know about os.join...)

if you called "append" with more than one argument, it converted
the arguments to a tuple and appended that tuple to the list
(not at all what "os.path.join" does, in other words).  This wasn't
documented, and wasn't intended either -- the reason was that
"append" used an outdated internal API that didn't differ between
a single tuple and multiple arguments.  For some more info, see
chapter 10 of this document:


(also see the style guide for more info on foolish consistencies ;-)

Cheers /F

More information about the Python-list mailing list