fork download
  1. import timeit
  2.  
  3.  
  4. print(timeit.timeit("reduce(add, a)", "from functools import reduce;from operator import add;a = ['x'] * 10"))
  5. print(timeit.timeit("str.join('', a)", "from functools import reduce;from operator import add;a = ['x'] * 10"))
Success #stdin #stdout 2.47s 9120KB
stdin
Standard input is empty
stdout
1.8871957249939442
0.5758084560511634