<br><br>On Wednesday, November 30, 2011, Robert Kern <<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>> wrote:<br>> On Wed, Nov 30, 2011 at 11:09, Giovanni Plantageneto<br>> <<a href="mailto:g.plantageneto@gmail.com">g.plantageneto@gmail.com</a>> wrote:<br>
>> Dear all,<br>>> I have a simple question. I would like to have all the parameters of a<br>>> model written in a configuration file (text), and I would like to have<br>>> all the parameters in the file automatically defined inside a program.<br>
>> I find ConfigParser a bit low level, is there any function that<br>>> automatically reads everything from a file?<br>><br>> You may want to give something like configobj a try.<br>><br>>  <a href="http://pypi.python.org/pypi/configobj">http://pypi.python.org/pypi/configobj</a><br>
><br>> It builds on ConfigParser to read all of the parameters in and creates<br>> a hierarchical object will all of the parameters as attributes.<br>><br>> --<br>> Robert Kern<br>><br>> "I have come to believe that the whole world is an enigma, a harmless<br>
> enigma that is made terrible by our own mad attempt to interpret it as<br>> though it had an underlying truth."<br>>   -- Umberto Eco<br>> _______________________________________________<br>> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>><br>
<br>+1 on configobj.  I use this module extensively for my simulation configuration.  It can even do some validation of parameters and allows for saving of comments.  Furthermore, it utilizes the dictionary idiom, which makes it very easy to work with, especially for passing kwargs to functions.<br>
<br>Cheers!<br>Ben Root