title: smartest way to join two lists into a formatted string
body: <p>Lets say I have two lists of same length:</p>
  
  <pre><code>a = ['a1', 'a2', 'a3']
  b = ['b1', 'b2', 'b3']
  </code></pre>
  
  <p>and I want to produce the following string:</p>
  
  <pre><code>c = 'a1=b1, a2=b2, a3=b3'
  </code></pre>
  
  <p>What is the best way to achieve this?</p>
  
  <p>I have following implementations:</p>
  
  <pre><code>import timeit
  
  a = [str(f) for f in range(500)]
  b = [str(f) for f in range(500)]
  
  def func1():
      return ', '.join([aa+'='+bb for aa in a for bb in b if a.index(aa) == b.index(bb)])
  
  def func2():
      list = []
      for i in range(len(a)):
          list.append('%s=%s' % (a[i], b[i]))
      return ', '.join(list)
  
  t = timeit.Timer(setup='from __main__ import func1', stmt='func1()')
  print 'func1 = ' + t.timeit(10) 
  
  t = timeit.Timer(setup='from __main__ import func2', stmt='func2()')
  print 'func2 = ' + t.timeit(10)
  </code></pre>
  
  <p>and the output is:</p>
  
  <pre><code>func1 = 32.4704790115
  func2 = 0.00529003143311
  </code></pre>
  
  <p>Do you have some trade-off?</p>