Make variable global

abcd codecraig at gmail.com
Wed Mar 21 15:55:41 EDT 2007


I have a file, "a.py"

blah = None
def go():
    global blah
    blah = 5

>From the python interpreter I try....

>>> from a import *
>>> blah
>>> go()
>>> blah
>>>

...i was hoping to see "5" get printed out the second time I displayed
blah, but it doesn't.  Now, if I type this same code directly into the
python interpreter it works as i was hoping.  what i am missing?

thanks




More information about the Python-list mailing list