title: Python string concatenation Idiom.  Need Clarification.
body: <p>From <a href="http://jaynes.colorado.edu/PythonIdioms.html" rel="nofollow noreferrer">http://jaynes.colorado.edu/PythonIdioms.html</a></p>
  <blockquote>
  <p>&quot;Build strings as a list and use
  ''.join at the end. join is a string
  method called on the separator, not
  the list. Calling it from the empty
  string concatenates the pieces with no
  separator, which is a Python quirk and
  rather surprising at first. This is
  important: string building with + is
  quadratic time instead of linear! If
  you learn one idiom, learn this one.</p>
  <p>Wrong: for s in strings: result += s</p>
  <p>Right: result = ''.join(strings)&quot;</p>
  </blockquote>
  <p>I'm not sure why this is true.  If I have some strings I want to join them, for me it isn't intuitively better to me to put them in a list then call ''.join.  Doesn't putting them into a list create some overhead?  To Clarify...</p>
  <p>Python Command Line:</p>
  <pre><code>&gt;&gt;&gt; str1 = 'Not'
  &gt;&gt;&gt; str2 = 'Cool'
  &gt;&gt;&gt; str3 = ''.join([str1, ' ', str2]) #The more efficient way **A**
  &gt;&gt;&gt; print str3
  Not Cool
  &gt;&gt;&gt; str3 = str1 + ' ' + str2 #The bad way **B**
  &gt;&gt;&gt; print str3
  Not Cool
  </code></pre>
  <p>Is <strong>A</strong> really linear time and <strong>B</strong> is quadratic time?</p>