saved sys.path

Alex Martelli aleaxit at yahoo.com
Wed Nov 3 03:30:34 EST 2004


Eric S. Johansson <esj at harvee.org> wrote:

> basis, I really believe that configuration information should be 
> externalized from the program as much as humanly possible.  So things

I agree.  But putting it in a scriptfile instead of a datafile is just
as good, IMHO -- just like, say, config info for my bash shell sessions
goes into a file .bashrc which is a script rather than being just a
datafile.  Most of what .bashrc does is setting environment variables,
but the extra flexibility of it being a script may still help.

Similarly, as I see things, config info for a big app (coded in Python,
or in whatever other language as long as it's got a Python accessible
interface) can be in a scriptfile instead of a datafile.  The scriptfile
starts up, adjusts environment info (sys.path foremost, but maybe other
stuff too), imports the app's main module, launches 'main(sys.argv)'
therein.  It _is_ externalized from the program, in my view -- it's a
configuration scriptfile.  It just works better, with Python, to have
the configuration scriptfile call the app's main, rather than doing it
the other way round as you would in, say, C (where the app's main starts
and then calls a configuration scriptfile).

I do like what you've posted, don't get me wrong -- I'm just pointing
out that our different preferences on app configuration architectures do
not descend from differences on the "externalized from the program"
philosophy!


Alex



More information about the Python-list mailing list