[Tutor] setting program configuration for all files and modules ofa program

Alan Gauld alan.gauld at btinternet.com
Tue Apr 15 11:08:59 CEST 2008

"Tim Michelsen" <timmichelsen at gmx-topmail.de> wrote in 

>> Another option is to have the config settiongs in a normal
>> Python module and just import it. 

> I think that the cfg-files are much more readable for others.

More readable than:

# Section Heading
variable = value

It looks pretty easy to read to me! :-)

If its very complex you can use dictionaries:

SectionFoo = {
firstName : theValue
second  : anotherValue

Which is still pretty easy for the casual reader/maintainer 
and allows access like:

import myconfig
foo2 = myconfig.SectionFoo['second']

Just a thought.

Alan G.

More information about the Tutor mailing list