[Python-ideas] Accept list in os.path.join

Terry Reedy tjreedy at udel.edu
Tue Jul 29 11:30:25 CEST 2014


On 7/29/2014 4:05 AM, Todd wrote:
> Currently, os.path.join joins strings specified in its arguments, with
> one string per argument.

One typically has 2 or possibly 3 path segements, never 1000.

> On its own, that is not a problem.  However, it is inconsistent with
> str.join, which accepts only a list of strings.  This inconsistency can
> lead to some confusion, since these operations that have similar names
> and carry out similar tasks have fundamentally different syntax.

I partly agree, but think about the actually use cases.

> My suggestion is to allow os.path.join to accept a list of strings in
> addition to existing one string per argument.

os.path.join(*iterable)


-- 
Terry Jan Reedy



More information about the Python-ideas mailing list