ConfigParser shootout, preliminary entry
Carlos Ribeiro
carribeiro at gmail.com
Wed Oct 20 08:24:25 EDT 2004
On Tue, 19 Oct 2004 20:27:53 -0500, Paramjit Oberoi <param at cs.wisc.edu> wrote:
> > Since then I've been playing around with this... not the parsing part (which
> > so far I have completely ignored) but the programmer interface. There needs
> > to be a well-thought-out data model for the information stored, and the user
> > interface needs to be very easy to use, yet not so "magical" that it becomes
> > difficult to understand.
>
> >From the me-too department:
>
> For me personally, the problems with ConfigParser were inconvenient value
> access/update and lack of order-preservation by the INI parser/writer. I
> have developed my own solution which:
>
> * Is convenient: both attribute access as well as container syntax can be
> used to access as well as update values:
>
> from cfgparse.iniparser import ini_namespace
> conf = ini_namespace()
> conf.user.name = 'Oberoi'
> print conf['user']['name']
> 'Oberoi'
>
> * Preserves order/indentation/spacing when the INI file is updated and
> when the data is accessed.
>
> * I have given some thought to the data model and interface question, but
> probably not as much as you. The data model simply is that of arbitrarily
> nested namespaces, each containing values (although each specific
> implementation of the model can have it's own restrictions - for example,
> INI files don't allow top-level values). The abstract model/interface
> allos conversion from one config format to another.
>
> * I have some code written using the ConfigParser API which I didn't want
> to have to update, so an API-compatible interface is also available which
> implements the old interface, as well as allowing access to the new one.
>
> The code can be found here:
>
> http://www.cs.wisc.edu/~param/software/cfgparse/
>
> -param
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com
More information about the Python-list
mailing list