python string formatting: way to not use two lists?
<p>With the following code:</p>

<pre><code>a = ['foo', 'bar', 'doh', 'rae']
</code></pre>

<p>I'd like the string <code>SUM(foo) AS foo, SUM(bar) AS bar, SUM(doh) AS doh, SUM(rae) AS rae</code>. This works:</p>

<p>Tried something clever like <code>'SUM(%s) AS %s' % ([x for x in a], [x for x in a])</code> but obviously it didn't work, and using two list comprehensions felt woefully inefficient.</p>

<p>Any tips?</p>
