Comments in ConfigParser module

Joel Granados joel.granados at gmail.com
Sun Apr 8 05:17:46 EDT 2007


On 7 Apr 2007 13:19:06 -0700, Gabriel Genellina <gagsl-py2 at yahoo.com.ar>
wrote:
>
> 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
> follows
>                             # a spacing character
>
> I think it's either a bug in the code or in the documentation.


Yep, IMO its a weirdness in the behavior that is not documented.

> 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
> line.
> The actual implementation discards any text following a <space>;
> sequence.


Yep.   This is just one of the situations where the documentation is
different from the actual behavior.

> 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).


Yep.  Here I just wanted to stress that in the RFC it states that the
comment doesn't necessarily have to be at the beginning of the line.

--
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Andrés Granados
Medellín Colombia
--
jgranad1 at eafit.edu.co
joel.granados at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070408/d56cb41c/attachment.html>


More information about the Python-list mailing list