string concatenation

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Mon Jun 28 05:48:49 EDT 2004


Peter Otten wrote:
> Reinhold Birkenfeld wrote:
> 
>> Where I would prefer the variant
>> 
>> str.join("", sequence)
>> 
>> as it is more readable for beginners (and demonstrates the concept of
>> invoking member methods as well ;)
> 
> If it prevents newbies from doing
> 
> import string
> string.join("", sequence)
> 
> so be it. Real men use "".join(seq) :-)

Maybe I'm not a real man, but the solution I like most (for code that
extensively concatenates strings in this way) is

join = lambda x: "".join(x)

Reinhold

-- 
Wenn eine Linuxdistribution so wenig brauchbare Software wie Windows
mitbrächte, wäre das bedauerlich.  Was bei Windows der Umfang eines
"kompletten Betriebssystems" ist, nennt man bei Linux eine Rescuedisk.
  -- David Kastrup in de.comp.os.unix.linux.misc



More information about the Python-list mailing list