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. Kent > > Amit Saxena wrote: >> The simplest way i could think of: >> >> a=["apple","orange","banana"] >> b = "" >> for i in range(len(a)): >> b += a[i] >> print b _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor