On Wed, 18 Mar 2009 00:47:30 -0700 (PDT), BlackMan890 <black...@simnet.is> > Hi there. > > When I run the following .py from C#: > > --- test.py ---------------- > > global crap > crap = None > > def set_crap(): > crap = "yay" > > def return_crap(): > return crap > ---------------------------
If you are going to modify a global variable within a function, you must use the "global" statement WITHIN THAT FUNCTION. Viz: # test.py crap = None def set_crap(): global crap crap = "yay" def return_crap(): return crap In your code, "crap" within "set_crap" is just a local variable, which goes away when the function exists. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com