A small test revealed that "".join(listOfStrings)
is
not faster than plain +=. The .join() is slower. Using .append() and .join() is slower.
real 0m2.908sTime with +=:
real 0m1.742sThe test:
#!/usr/bin/env python def combine(inc, count): text = "" for i in xrange(count): text += inc return len(text) def combineByJoin(inc, count): text = [] for i in xrange(count): text.append(inc) text = "".join(text) return len(text) def main(): inc = "a" * 10 print combine(inc, 10000000) #print combineByJoin(inc, 10000000) main()Tested on Python 2.5.2.