Re: Make variable global

2007-03-21 Thread Steve Holden
abcd wrote: > 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.

Re: Make variable global

2007-03-21 Thread aspineux
try >>> import a >>> a.blah >>> a.go() >>> a.blah or rewrite a.py like this blah = [ None ] def go(): global blah blah[0] = 5 # and not blah=[5] then >>> from a import * >>> blah >>> go() >>> blah will work as expected in case 1 ( import a ) blah in a.py and a.blah in python interpr

Re: Make variable global

2007-03-21 Thread Bruno Desthuilliers
abcd a écrit : > 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 doe

Re: Make variable global

2007-03-21 Thread Gary Herron
abcd wrote: > 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,

Re: Make variable global

2007-03-21 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 abcd wrote: > 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,

Make variable global

2007-03-21 Thread abcd
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