Use of global

Mike Tibbs (tibbs@dopey.si.com)
Fri, 31 Mar 95 17:22 EST

This is a newbie question, but anyway:

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