I have a question on global variables and how to use them.  I have 2 files;
a.py & b.py

# a.py -----

myvar = { 'test' : '123' }

# -------
# b.py -----

from a import myvar

def test():
     a.myvar = { 'blah' : '456' }

# -----

If I *'import a*' & type *'a.myvar'* it prints 'test' & '123'.

Now, if I *'import b'* & type *'b.test()'* ... does this actually change the
contents of myvar? It seems I have to do *'print b.myvar'* to see the change
but really I want to just simply do* 'print myvar'*. I want to be able to
change myvar anywhere. Please help me grasp this concept.

Thanks in advance.

-- 
  Rob
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to