String concatenation performance

Duncan Booth duncan.booth at invalid.invalid
Thu May 11 10:27:48 EDT 2006


Cristian.Codorean wrote:

> I was just reading a "Python Speed/Performance Tips" article on the
> Python wiki
> http://wiki.python.org/moin/PythonSpeed/PerformanceTips
> and I got to the part that talks about string concatenation and that
> it is faster when using join instead of += because of strings being
> immutable.

... snip ...

> So what am I doing wrong ?
> 

What you are doing wrong is failing to search the newsgroup to see if
anyone else has asked the same question within the last few days. In
particular see the thread titled 'which is better, string concatentation
or substitution?' message <445ec45e$0$1965$c3e8da3 at news.astraweb.com> 

http://groups.google.co.uk/group/comp.lang.python/browse_frm/thread/2d060eb94730bedb/06412fc21aa1fe8c?#06412fc21aa1fe8c



More information about the Python-list mailing list