Speed of string += string

Mads Orbesen Troest mads at troest.NEVERMORE.dk
Sat Apr 12 14:37:29 EDT 2003


On Sat, 12 Apr 2003 18:45:26 GMT, Alex Martelli wrote:

> Building up lists of strings with mylist.append(piece), then joining
> them together at the end with ''.join(mylist), is the canonical solution;
> others, which I've seen already pointed out to you, include using cStringIO.

Alex, thanks for your response. I had a hunch the += approach would be a 
performance killer. I'll try the list.append approach.

Regards,
   /\/\\ads Orbesen Troest




More information about the Python-list mailing list