Python way to convert argument list to string
<p>I've inherited some Python code that constructs a string from the string arguments passed into <code>__init__</code>:</p>

<pre><code>self.full_tag = prefix + number + point + suffix
</code></pre>

<p>Maybe I'm just over-thinking it but is this the best way to concatenate the arguments? I know it's possible to do something like:</p>

<pre><code>self.full_tag = "".join([prefix, number, point, suffix])
</code></pre>

<p>Or just using string format function:</p>

<pre><code>self.full_tag = '{}{}{}{}'.format(prefix, number, point, suffix)
</code></pre>

<p>What is the Python way of doing this?</p>

<p><em>Pythonic</em> way is to follow <a href="https://www.python.org/dev/peps/pep-0020/" rel="nofollow">The Zen of Python</a>, which has several things to say about this case:</p>

<ul>
<li><p>Beautiful is better than ugly.</p></li>
<li><p>Simple is better than complex.</p></li>
<li><p>Readability counts.</p></li>
</ul>

<p>Add to that the famous quote by DonaldKnuth:</p>

<blockquote>
  <p>We should forget about small efficiencies, say about 97% of the time:
  premature optimization is the root of all evil.</p>
</blockquote>

<p>With those in mind, the best of your choices is:</p>

<pre><code>self.full_tag = prefix + number + point + suffix
</code></pre>

<p>Although, if number is really a number and point point is really a point, then this is more explicit:</p>

<pre><code>self.full_tag = "%s%d.%s" % (prefix, number, suffix)
</code></pre>

<ul>
<li>Explicit is better than implicit.</li>
</ul>

python python-2.7