[issue27824] update ConfigParser docs regarding in-line comments

Joshua Haas report at bugs.python.org
Mon Aug 22 18:48:28 EDT 2016


Joshua Haas added the comment:

I'm not sure it's deprecated so much as moved. Python 3.5 includes an additional init parameter, so setting inline_comment_prefixes=';' allows inline comments even for values containing the ';' character, displaying the "expected behavior" described in my original bug report. They are, however, disabled by default, unlike in Python 2.7.

I also have a different proposal I think might be more clear:

Configuration files may include comments, prefixed by specific characters. Comments may appear on their own in an otherwise empty line using either '#' or ';'. In addition, inline comments can be added to the end of a line after a ';' as long as the ';' is preceded by a whitespace character. Only the first ';' in a line is checked, so an inline comment cannot be added to lines that already contain any ';'s.

I'm also wondering if an example would be a good idea, as I don't think any of the examples on the doc page include comments:

# this is a comment
; this is also a comment
foo = bar ; inline comment
password = jgfw;as1 ; this will be parsed as part of 'password'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27824>
_______________________________________


More information about the Python-bugs-list mailing list