[issue1271] Raw string parsing fails with backslash as last character

Graham Wideman report at bugs.python.org
Sat Mar 12 01:56:43 CET 2011


Graham Wideman <initcontact at grahamwideman.com> added the comment:

@Glenn Linderman:  I too am usually quick to assume that "innocent fixes" may have serious unforeseen impacts, but in this case I'm not convinced.  What would matter is to enumerate the current behavior, and of that what would be changed.  You seem to have had experience with other raw-string features/gotchas -- please share! :-)

@David Murray: Excuse denseness on my part, but I'm not following the logic of your first paragraph.  I think you are saying that current raw string has to do something special to be able to contain the sequence backslash-quote, and this has the side effect of precluding that sequence appearing last in a string.  

But surely a completely-escape-free string could also contain backslash-quote just fine (assuming the string is surrounded by the other kind of quote).  So I'm thinking that the case you mention is not the driver here.  

It's conceivable there is some more complicated case where backslash-singlequote AND backslash-doublequote MUST appear literally in the same string.  However, it seems a little bizarre to worry about that case, but not worry about the simpler case of wanting both a plain singlequote and a plain doublequote in the same string.  Maybe there's some popular regular expression that calls for this complexity.

I concur that inspection of the parser (and the history and intent of this design) would be fascinating.

----------

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


More information about the Python-bugs-list mailing list