Get a dict of all variables currently in scope and their values
<p>Consider this snippet:</p>

<pre><code>globalVar = 25

def myfunc(paramVar):
    localVar = 30
    print "Vars: {globalVar}, {paramVar}, {localVar}!".format(**VARS_IN_SCOPE)

myfunc(123)
</code></pre>

<p>Where <code>VARS_IN_SCOPE</code> is the dict I'm after that would contain <code>globalVar</code>, <code>paramVar</code> and <code>localVar</code>, among other things.</p>

<p>I'd like to basically be able to reference all the variables that are currently in scope inside the string. Hence the expected output would be:</p>

<p><code>Vars: 25, 123, 30</code></p>

<p>I can achieve this by passing <code>**dict(globals().items() + locals().items())</code> to <code>format()</code>. Is this always correct or are there some corner cases that this expression would handle incorrectly?</p>

<p><em>Rewritten to clarify the question.</em></p>
