string concatenation

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


Peter Otten wrote:

> The faster idiom will then become
> 
> sequence = []
> for name in contextForm.keys():
>     sequence += ["Input: ", name, " value: ", contextForm[name].value,
>         "<BR>"]
> context = "".join(sequence)

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 ;)

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