why does this work:
def function1():
a = 10
def function2():
print a
function2()
but this does not:
def function1():
a = 10
def function2():
print a
a -= 1
if a>0:
function2()
function2()
error:
UnboundLocalError: local variable 'a' referenced before assignment