#define equivalents and config files
Remco Gerlich
scarblac at pino.selwerd.nl
Thu Mar 21 08:27:41 EST 2002
Dave Swegen <dswegen at software.plasmon.com> wrote in comp.lang.python:
> I'm basically after a single file where such values can be stored, and
> then used in various parts of the program without having to pass extra
> configuation variables around.
How about just putting them in a module?
Have a file constants.py that just reads
name = "My Program"
pi = 3.1415926536
Then you can import constants and use constants.name, constants.pi, etc. You
can even "from constants import *" to directly put them in another module as
variables.
--
Remco Gerlich
More information about the Python-list
mailing list