[Tutor] setting program configuration for all files and modules of a program

Kent Johnson kent37 at tds.net
Tue Apr 15 03:46:10 CEST 2008


Tim Michelsen wrote:
> What is the state of the art in storing and parsing configuraions in 
> python programs?

It is pretty common to have a configuration module that is imported 
wherever the configuration is needed. This is simple but it is 
essentially global state and shares some of the disadvantages of 
globals; in particular it couples all your code to the settings module 
and makes testing more difficult.

The alternative is to pass a configuration object to whatever needs it. 
This eliminates the coupling but is more painful to implement.

Kent



More information about the Tutor mailing list