This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients QuantumTim, facundobatista, georg.brandl, gwideman, v+python
Date 2011-03-11.19:41:15
SpamBayes Score 1.9373392e-14
Marked as misclassified No
Message-id <1299872476.38.0.274647245484.issue1271@psf.upfronthosting.co.za>
In-reply-to
Content
I can certainly agree with the opinion that raw strings are working as documented, but I can also agree with the opinion that they contain traps for the unwary, and after getting trapped several times, I have chosen to put up with the double-backslash requirement of regular strings, and avoid the use of raw strings in my code.  The double-backslash requirement of regular strings gets ugly for Windows pathnames and some regular expressions, but the traps of raw strings are more annoying that that.

I'm quite sure it would be impossible to "fix" raw strings without causing deprecation churn for people to whom they are useful (if there are any such; hard for me to imagine, but I'm sure there are).

I'm quite sure the only reasonable "fix" would be to invent a new type of "escape-free" or "exact" string (to not overuse the term raw, and make two types of raw string).  With Python 3, and UTF-8 source files, there is little need for \-prefixed characters (and there is already a string syntax that permits them, when they are needed), so it seems like inventing a new string syntax

e'string'
e"""string"""

which would not treat \ in any special manner whatsoever, would be useful for all the cases raw strings are presently useful for, and even more useful, because it would handle all the cases that are presently traps for the unwary that raw-strings have.

The problem mention in this thread of escaping the outer quote character is much more appropriately handled by the triple-quote form.  I don't know the Python history well enough to know if raw strings predated triple-quote; if they didn't, there is would have been no need for raw strings to attempt to support such.
History
Date User Action Args
2011-03-11 19:41:16v+pythonsetrecipients: + v+python, georg.brandl, facundobatista, QuantumTim, gwideman
2011-03-11 19:41:16v+pythonsetmessageid: <1299872476.38.0.274647245484.issue1271@psf.upfronthosting.co.za>
2011-03-11 19:41:15v+pythonlinkissue1271 messages
2011-03-11 19:41:15v+pythoncreate