Python variable resolving
<p>Given the following code:</p>

<pre><code>a = 0
def foo():
  # global a
  a += 1
foo()
</code></pre>

<p>When run, Python complains: UnboundLocalError: local variable 'a' referenced before assignment</p>

<p>However, when it's a dictionary...</p>

<pre><code>a = {}
def foo():
  a['bar'] = 0
foo()
</code></pre>

<p>The thing runs just fine... </p>

<p>Anyone know why we can reference a in the 2nd chunk of code, but not the 1st?</p>
