By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

ConfigParser: whitespace leading comment lines

P: n/a
Hello all,
I'd like to propose the following change to ConfigParser.py.
I won't call it a bug-fix because I don't know the relevant standards.
This change will enable multiline comments as follows:

[section]
item=value ;first of multiline comment
;second of multiline comment

Right now the behaviour is

In [19]: cfg.get('section','item')
Out[19]: 'value\n;second of multiline comment'

It's a one-line change.
RawConfigParser._read lines 434-437
# comment or blank line?
- if line.strip() == '' or line[0] in '#;':
+ if line.strip() == '' or line.strip()[0] in '#;':
continue

Regards,
Greg Willden

Oct 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
***********************
Your mail has been scanned by InterScan MSS.
***********************
On Friday 13 October 2006 04:13, gw******@gmail.com wrote:
I'd like to propose the following change to ConfigParser.py.
IMO there's a reason that left it in such way.
Whom didn't like the ConfigParser classes had made a new module, and I could
find a the least 4 of them (cfgparse, config, configobj, pytconfpy).
I choose ConfigParser because I'm very new and I haven't learn how to
implement subclasses.
I also will to use ConfigParser with some more feature like sub-options, but I
didn't get that clue :(
If you don't like that behavior easy you can override it in a subclass and use
the way you prefer.

F

Oct 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.