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.

classification
Title: Raw string parsing fails with backslash as last character
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Raw string parsing fails with backslash as last character
View: 1271
Assigned To: Nosy List: QuantumTim, ezio.melotti, facundobatista, georg.brandl, gwideman
Priority: normal Keywords:

Created on 2011-03-09 10:49 by gwideman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg130443 - (view) Author: Graham Wideman (gwideman) Date: 2011-03-09 10:49
This is a copy of issue 1271 because I couldn't find a way to reopen it.

So, repeating my comment here:

As it currently stands, backslash at end of string is prohibited, apparently in the interests of supposedly allowing backslash to escape quotes that might be embedded within the string. 

But the supposedly beneficial backslash-escaping-embedded quote behavior is broken because the backslash remains in the string.

Consider:
(a) We already have the ability to use either single or double quotes around the string which gives that chance to use the other quote within the string. 
(b) The "principle of least surprise" for raw string would be to have raw mean "Never Escape Anything"
(c) backslash on end of string is currently a trap waiting to happen for Windows paths.
So I think there is strong motivation to abandon the currently broken "backslash escapes quote" behavior and just let raw strings be totally raw.  Furthermore, it's hard to imagine that such a move would break anything.  (Famous last words, I know... but I challenge anyone to contrive such a scenario!)
msg130445 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-03-09 10:51
I reopened #1271, please continue the discussion there.
History
Date User Action Args
2022-04-11 14:57:14adminsetgithub: 55660
2011-03-09 10:51:29ezio.melottisetstatus: open -> closed

superseder: Raw string parsing fails with backslash as last character

nosy: + ezio.melotti
messages: + msg130445
resolution: duplicate
stage: resolved
2011-03-09 10:49:43gwidemancreate