Python Practices for Efficient Code: Performance, Memory, and Usability
&gt; Use format instead of + for generating strings — In Python, str is immutable, so the left and right strings have to be copied into the new string for every pair of concatenations.<p>It isn&#x27;t always faster to use string formatting.<p><pre><code>    $ python -m timeit -s &#x27;a, b, c, d = &quot;1234567890&quot;, &quot;abcdefghij&quot;, &quot;ABCDEFGHIJ&quot;, &quot;0987654321&quot;&#x27; &#x27;a + b + c + d&#x27;
    10000000 loops, best of 3: 0.181 usec per loop
    $ python -m timeit -s &#x27;a, b, c, d = &quot;1234567890&quot;, &quot;abcdefghij&quot;, &quot;ABCDEFGHIJ&quot;, &quot;0987654321&quot;&#x27; &#x27;&quot;{}{}{}{}&quot;.format(a, b, c, d)&#x27;
    1000000 loops, best of 3: 0.447 usec per loop
    $ python --version
    Python 2.7.13</code></pre>