1>>> foo = None
2>>> def bar():
3... global foo
4... if False:
5... foo = 'spam'
6... print foo
7...
8>>> bar()
9None
10
11# Python needs to know in the beginning of the function if you plan on using the local or the
12# global version of the variable. Remember that you can't declare variables in python. You can
13# only bind them. Read more in the naming and binding section of the python reference documentation
14# https://docs.python.org/2.3/ref/naming.html