[Python-3000] Automatically invoking str() in str.join()

Walter Dörwald walter at livinglogic.de
Mon May 1 13:20:07 CEST 2006


Nick Coghlan wrote:
> Thomas Wouters wrote:
>> It doesn't matter. Either case is confusing, one way or another, as Tim 
>> has already argued. Changing it would be a big mistake. If you want me 
>> to come with more comprehensive arguments (other than what Tim already 
>> covered), please come with more comprehensive arguments *for* the 
>> change, too.
> 
> What if the join() builtin had a similar signature to min() & max(), and the 
> separator was a keyword only argument? Something like:
> 
>    def join(*args, **kwds):

In many cases what I pass to join() is a generator expression. If the 
separator was a separate argument, I'd have to wrap the generator in (), 
which IMHO is uglier that the status quo:

",".join(word.upper() for word in words)

vs.

join((word.upper() or word in words), sep=",")

Servus,
    Walter



More information about the Python-3000 mailing list