Message93776
The shlex module does not function as expected in the presence of
comments when newlines are not whitespace. An example (attached):
>>> from shlex import shlex
>>>
>>> lexer = shlex("a \n b")
>>> print ",".join(lexer)
a,b
>>>
>>> lexer = shlex("a # comment \n b")
>>> print ",".join(lexer)
a,b
>>>
>>> lexer = shlex("a \n b")
>>> lexer.whitespace=" "
>>> print ",".join(lexer)
a,
,b
>>>
>>> lexer = shlex("a # comment \n b")
>>> lexer.whitespace=" "
>>> print ",".join(lexer)
a,b
Now where did my newline go? The comment ate it! Even though the docs
seem to indicate the newline is not part of the comment itself:
shlex.commenters:
The string of characters that are recognized as comment beginners.
All characters from the comment beginner to end of line are ignored.
Includes just '#' by default. |
|
Date |
User |
Action |
Args |
2009-10-09 08:11:54 | jjdmol2 | set | recipients:
+ jjdmol2 |
2009-10-09 08:11:54 | jjdmol2 | set | messageid: <1255075914.03.0.04545559487.issue7089@psf.upfronthosting.co.za> |
2009-10-09 08:11:51 | jjdmol2 | link | issue7089 messages |
2009-10-09 08:11:51 | jjdmol2 | create | |
|