[Numpy-discussion] Reading automatically all the parameters from a file
Wed Nov 30 09:11:05 CST 2011
On Wednesday, November 30, 2011, Robert Kern <email@example.com> wrote:
> On Wed, Nov 30, 2011 at 11:09, Giovanni Plantageneto
> <firstname.lastname@example.org> wrote:
>> Dear all,
>> I have a simple question. I would like to have all the parameters of a
>> model written in a configuration file (text), and I would like to have
>> all the parameters in the file automatically defined inside a program.
>> I find ConfigParser a bit low level, is there any function that
>> automatically reads everything from a file?
> You may want to give something like configobj a try.
> It builds on ConfigParser to read all of the parameters in and creates
> a hierarchical object will all of the parameters as attributes.
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
> -- Umberto Eco
> NumPy-Discussion mailing list
+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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion