[Python-ideas] Add list.join() please

Terry Reedy tjreedy at udel.edu
Tue Jan 29 18:30:46 EST 2019

On 1/28/2019 8:40 PM, Jamesie Pic wrote:

 > 0. os.path.join takes *args

Since at least 1 path is required, the signature is join(path, *paths). 
I presume that this is the Python version of the Unix version of the 
system call that it wraps..  The hidden argument is os.sep.  It is 
equivalent to os.sep.join((path,)+paths) (though one would not write it 
this way).

> 1. str.join takes a list argument,

This premise behind the (repeated) request is a false.  str.joins 
arguments are a string (the joiner) and an *iterable of strings*, which 
is an abstract subclass of the abstract concept 'iterable'.  And only a 
small fraction of lists are lists of strings and therefore iterables of 

Terry Jan Reedy

More information about the Python-ideas mailing list