Why does this generate a NameError?
>>> global gvar
>>> def f():
... gvar = 'xxx'
...
>>> def main():
... print gvar
...
>>> main()
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in main
NameError: evar