I'm working on an app that will be deployed on several different
servers.  In each case, I'll want to change some config info (database
name, paths, etc.)

In perl, I would have done something like this:

  Package Config;
  <some exporting mechanics>
  $dbname = "somename";
  etc.

And then use'd the module and referenced the vars as $Config::dbname.

What is a pythonic equivalent?  These vars are only changed usually at
install time.

I could set up a class and then instantiate it, but that seems a
waste...I guess what I'm looking for is either (a) a way to suck
variables into a namespace keeping a prefix (without having to prefix
all the vars with something like config_) - e.g., reference them as
config.dbname or something - is this execfile? or (b) class variables,
which is the route I usually take in Java if not using preferences,
etc.

I'm aware of configParser and such, and could certainly write a module
that parses a configuration file, but using a native python module
seems the easiest.  I want to do something reasonably pythonic so the
python Gods do not smite me for some stupid perlism ;)

Thanks.

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

Reply via email to