cpython - '{0}'.format() is faster than str() and '{}'.format() using IPython %timeit and otherwise using pure Python -
so it's cpython thing, not quite sure has same behaviour other implementations. but '{0}'.format() faster str() , '{}'.format() . i'm posting results python 3.5.2 , but, tried python 2.7.12 , trend same. %timeit q=['{0}'.format(i) in range(100, 100000, 100)] %timeit q=[str(i) in range(100, 100000, 100)] %timeit q=['{}'.format(i) in range(100, 100000, 100)] 1000 loops, best of 3: 231 µs per loop 1000 loops, best of 3: 298 µs per loop 1000 loops, best of 3: 434 µs per loop from docs on object.__str__(self) called str(object) , built-in functions format() , print() compute “informal” or nicely printable string representation of object. so, str() , format() call same object.__str__(self) method, difference in speed come from? update @stefanpochmann , @leon noted in comments, different results. tried run python -m timeit "..." and, right, because results are: $ python3 -m timeit "['{0}'.format(...