|
|
|
|
|
by gamegoblin
4661 days ago
|
|
Interestingly enough, this is pretty much the example given for the timemit module: http://docs.python.org/2/library/timeit.html Results: $ python -m timeit '"-".join(str(n) for n in range(100))'
10000 loops, best of 3: 40.3 usec per loop
$ python -m timeit '"-".join([str(n) for n in range(100)])'
10000 loops, best of 3: 33.4 usec per loop
$ python -m timeit '"-".join(map(str, range(100)))'
10000 loops, best of 3: 25.2 usec per loop
|
|
Full results: https://gist.github.com/dbarlett/6479378