Comments in ConfigParser module
gagsl-py2 at yahoo.com.ar
Sat Apr 7 22:19:06 CEST 2007
Joel Andres Granados wrote:
> The module also allows the comments to appear in the same line as the
> "name = value" constructs. The only difference being that this is only
> possible with ";" and not with "#" character. I did not see this in the
> documentation but this is how it is behaving.
Yes, it's not documented. There is only a comment in the source code:
# ';' is a comment delimiter only if it
# a spacing character
I think it's either a bug in the code or in the documentation.
> QUESTION...So the question is:
> Can you use "#" and ";" as comment characters? and if so why does the
> "#" not apply for the same situations as the ";"?
If you follow the documentation, comments are ONLY allowed to start a
The actual implementation discards any text following a <space>;
> Just for reference:
> On the RFC 822 <http://www.faqs.org/rfcs/rfc822.html> (a document
> referenced in the documentation) there is a mention of ";" being used as
> comment character but not necessarily at the beginning of the line.
RFC822 uses ";" to include comments in the syntax rules, not for
comments in the actual message headers (parenthesis are used there).
More information about the Python-list