Author Pedro Lacerda
Recipients Pedro Lacerda, gvanrossum, kernc, lukasz.langa, martin.panter, paul.moore, serhiy.storchaka, terry.reedy, tshepang
Date 2016-06-11.20:59:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I also never found a mixture of sectionless options followed by sectioned options. So an unnamed section that is also the DEFAULTSECTION will probably work.

In this patch when `default_section=None` is passed to `RawConfigParser` it will parse top level options into the default section and skip writing its title.

As drawback, default options is not showed in `options()` or `has_section()` reducing it usefulness. It works with `items()` and `keys()` however.

> Using DEFAULTSECT for this purpose is equally wrong since it would
> silently inject default values to every section

I disagree with that because I really *never* found in wild a file where it will happen.

> All in all, it comes down to the question whether the programmer
> expects section-less configuration. If not, the '' section will not be 
> helpful anyway. If yes, then it's desirable to be able to specify a
> section name for global options at *read time*.

Pass a name at read time will improve the API as `sections()` and `has_section()` will work as usual and not like a DEFAULTSECTION.

Please look my patch and tell if it's acceptable, if you prefer that a section name must be given at read and write time we can manage it.

It's my first post in this tracker and I'm very glad that I got it working even if not merged!
Date User Action Args
2016-06-11 20:59:23Pedro Lacerdasetrecipients: + Pedro Lacerda, gvanrossum, terry.reedy, paul.moore, lukasz.langa, tshepang, martin.panter, serhiy.storchaka, kernc
2016-06-11 20:59:23Pedro Lacerdasetmessageid: <>
2016-06-11 20:59:23Pedro Lacerdalinkissue22253 messages
2016-06-11 20:59:22Pedro Lacerdacreate