Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? >
#module global: def f(atom): global a a=1 globals()[atom+'var']=2 def f(): a=b=1 globals().update(locals()) _global=sys.modules[__name__] def f(atom): _global.a = 1 setattr(_global,atom+'var', 2) # all/app global import myglobals def f(atom): myglobals.a=1 setattr(myglobals....) your example application seems to point towards 'odd' use of these techniques. -robert -- http://mail.python.org/mailman/listinfo/python-list