Unpythonic way of printing variables in Python?
<p>Someone has recently demonstrated to me that we can print variables in Python like how Perl does.</p>

<p>Instead of:</p>

<pre><code>print("%s, %s, %s" % (foo, bar, baz))
</code></pre>

<p>we could do:</p>

<pre><code>print("%(foo)s, %(bar)s, %(baz)s" % locals())
</code></pre>

<p>Is there a less hacky looking way of printing variables in Python like we do in Perl? I think the 2nd solution actually looks really good and makes code a lot more readable, but the locals() hanging around there makes it look like such a convoluted way of doing it.</p>
