On Tuesday, 29 September 2009 20:24:53 Mars creature wrote: > >From the link Gregor posted, it seems no way to share variable between > > modules. > > I can understand the point that global variables tends to mess up > programs. > > Assume that I have 10 parameters need to pass to the function. If > these parameters are fixed, I can use another module to store these 10 > parameters, and import to the module, as suggested by jean-michel. But > what if these 10 parameters will be changed in the main program? > Passing the variable to the function as a parameter suggested by Rami > will certainly do, but I am wondering weather there are other ways. > What you'd like to code it?
You can put all the 10 things in a file called say my_params.py. Then where you need it, you do either: from my_params import * to make them available where needed, or: import my_params as p and access them as: print p.my_parm_1,p.my_parm_2,p.my_parm_3,p.my_parm_4 - Hendrik -- http://mail.python.org/mailman/listinfo/python-list