[Tutor] Noob question

Dick Moores rdm at rcblue.com
Tue Dec 11 22:43:19 CET 2007


At 04:19 AM 12/11/2007, Kent Johnson wrote:
>Eric Brunson wrote:
> > Hi Amit,
> >
> > This is fairly inefficient.  Because strings in python are immutable
> > this approach causes a new string to be created every iteration.
>
>This is not true of CPython (the standard python.org release) since
>version 2.4:
>http://www.python.org/doc/2.4.4/whatsnew/node12.html#SECTION0001210000000000000000
>
>Other versions of Python (Jython, IronPython, PyPy) do not have this
>optimization AFAIK.

Concatenating strings is still VERY slow in CPython 2.5.1 compared to 
using join(), however. See <http://py77.python.pastebin.com/f66c3b3da>.

Dick Moores 



More information about the Tutor mailing list