[Python-Dev] ConfigParser with a single section

Gustavo Niemeyer niemeyer@conectiva.com
Wed, 6 Nov 2002 23:45:40 -0200

Patch #549037 implements an interesting feature: it allows one to have
configuration files without headers. I'd like to know what's your
opinion about this issue, so that we can either forget the issue or
implement the functionality, closing that bug.

A few comments about the issue:

I would use a different implementation than the one provided in the
patch. The patch includes a new parameter in read functions, stating
what's the first section name. It means that we could have other
sections after the first unheaded section. IMO, that situation should
still be considered an error.

One possible way to implement it is to include a "noheaders" boolean
parameter for the constructor. Then, the user would have to know what's
the standard single section name, to pass it to functions like get().

Another way would be to include something like a "singlesection" parameter
in the constructor. This parameter would accept a string option, which
would name the single section.

As an argument against the whole issue, I'm not sure how unconfortable
it is to simply include a header in the file to satisfy the parser.

As an argument favorable, this could allow ConfigParser to parse simple
(no escapes or variables) shell configuration files and other simple
configurations using NAME=VALUE style.

What's your suggestion?

Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]