global variables
Chris Liechti
cliechti at gmx.net
Mon Jul 22 17:15:36 EDT 2002
Thorsten Harms <thorstenharms at arcor.de> wrote in
news:mailman.1027363530.26305.python-list at python.org:
> Hi!
> I 'm completely new to python.
willkommen
> So here's my problem:
> How can I handle global data in my application?
> The application is a database application and I want
> to provide non-static informations, like the user id, name,
> etc. so that every object can access this information.
> Normally, I use C/C++ for coding, but these tricks don't
> work ;-)
> Maybe, you can give me some hints...
if you need to access this data from different modules, put the data in a
module that you import in each other. (modules are singletons in python)
--file: myglobals.py --
names = id = None
--file: someothermod.py
import myglobals
myglobals.name = "Chris"
... etc.
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list