why use special config formats?

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Fri Mar 10 16:04:29 CET 2006

tomerfiliba at gmail.com enlightened us with:
> i came to this conclusion a long time ago: YOU DON'T NEED CONFIG
> FILES FOR PYTHON. why re-invent stuff and parse text by yourself,
> why the interpreter can do it for you?

Because you generally don't want to give the configuration file writer
full control over the Python virtual machine.

> for the most common case, static configuration, you just have a
> human-edited config file holding key-and-value pairs. so just add to
> your package a file called config.py, and import it.

Which only works if there is only one configuration file per
installation of your package, and is writable by the users that need
to configure it. For example, per-user database connection parameters
should be in $HOME/.programrc on UNIX systems. A program's preference
settings should be stored in a user-writable file to, preferably in
the user's homedir.

The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa

More information about the Python-list mailing list