string concatenation

Peter Otten __peter__ at web.de
Mon Jun 28 12:09:33 CEST 2004


Reinhold Birkenfeld wrote:

> Maybe I'm not a real man, but the solution I like most (for code that

Of course not, because real men never show doubt :-)
(If hard pressed, I'll admit I'm no more "real" than you in that respect)

> extensively concatenates strings in this way) is
> 
> join = lambda x: "".join(x)

Vicious lambda - tricks you into believing that you need it.

>>> join = " ".join
>>> join(["all", "of", "us"])
'all of us'
>>>

Now that's an idiom we both like, I suppose.

Peter




More information about the Python-list mailing list