Paul D.Smith wrote:
> 2. A simple Python config which searches for all shell environment variables
> named "MY_..." and instantiates then as Python variables.

my_vars = dict((k, v)
                for k, v in os.environ.iteritems()
                if k.startswith('MY_'))
globals().update(my_vars)

If you ever refactor the code, I'd suggest writing a single 
configuration file instead of setting environment variables, and reading 
that configuration file in each script that needs it.  Generally I've 
found that relying on environment variables being set is hard to 
maintain and a real pain when you have to move to a new system.

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to