Profiling string concatanation:
In [1]: import string
In [2]: %%timeit s=""; long_list=list(string.ascii_letters)*50
....: for substring in long_list:
....: s+=substring
....:
1000 loops, best of 3: 570 us per loop
In [3]: %%timeit long_list=list(string.ascii_letters)*50
....: s="".join(long_list)
....:
100000 loops, best of 3: 16.1 us per loop
Profiling loops over iterables and lists:
In [4]: %timeit for i in range(100000):pass
100 loops, best of 3: 2.82 ms per loop
In [5]: %timeit for i in list(range(100000)):pass
100 loops, best of 3: 3.95 ms per loop