global variables in module

Zunbeltz Izaola zunbeltz at wm.lc.ehu.es.XXX
Thu Feb 5 09:21:17 EST 2004


Harald Massa <cpl.19.ghum at spamgourmet.com> writes:

> Zunbeltz,
> 
> > MyApp(wxApp):
> > How can i use cf in other modules of the program. Did I need declare cf
> > global, or make it a module variable, ... Any hint, please
> 
> is used the following approach:
> 
> 1) defining one module named
> 

I've take another aproach. I've created a module where I define a class
derived from ConfigParse. I've take the idea from the source of idle.

> ReportGlobals
> 
> loggedInUser="nasenbaer"
> workerQueue=Queue.Queue()
> 
> there all varibles which are "konfiguration related" are defined, also 
> "programm global queues", "error loggers", "database connection pool"
> 
> All these variables are defined as module level variables
> (on "indent 0" :))) )
> 
> 2) in all modules of the programm I use
> 
> import ReportGlobals as gl
> 
> print "You are %s" % (gl.loggedInUser,)
> 
> 
> HTH
> 
> Harald
> 
> 
Thanks for your answer

Regards,

Zunbeltz

> 
> and access the



More information about the Python-list mailing list