configobj

Andrea Crotti andrea.crotti.0 at gmail.com
Tue Jan 31 11:06:16 EST 2012


I have a couple of questions about configobj, which I'm happily trying
to use for this project.

The first question is, how do I make a very long list of things?
Suppose I have declared in a spec file.

val = string_list

now I would like to do
val = one,
       two,
       three

but that's not allowed, and also
val = one, \
       two, \
       three

doesn't work, is there a way to avoid to write everything on one line?

The second question is, how do I avoid declaring twice the default
value?

For example supposing I have this spec:
skip_pesky_pyc_paths = string_list

I was giving for granted that (pseudocode ahead)
conf = ConfigObj(spec=myspec)
conf['skip_pesky_pyc_paths'] == []

but it's not the case, if it's not declared in the conf file it just
doesn't find the key?
Is there a magic option to make it create the key when they are not
declared from the spec?

Thanks,
Andrea

PS. and why by the way ConfigObj is not in the standard lib, instead of 
ConfigParser,
     which looked less complete and more cumbersome (to me at least)



More information about the Python-list mailing list