Python: Please help me understand this scope issue
<p>Going from Javascript to Python really just means that scope is Satan reincarnated.</p>

<p>With this code, everything is fine:</p>

<pre><code>a = 10

def elFunction():
    print a
    if (4 &gt; 2):
        print a

elFunction()
</code></pre>

<p>With this code, I die a little inside</p>

<pre><code>a = 10

def elFunction():
    a += 1
    if (4 &gt; 2):
        print a

elFunction()
</code></pre>

<p>Why does this code draw an error?</p>