unbound variable python pylance code example

Example: python unbound variable

>>> foo = None
>>> def bar():
...     global foo
...     if False:
...         foo = 'spam'
...     print foo
... 
>>> bar()
None

# Python needs to know in the beginning of the function if you plan on using the local or the
# global version of the variable. Remember that you can't declare variables in python. You can
# only bind them. Read more in the naming and binding section of the python reference documentation
# https://docs.python.org/2.3/ref/naming.html