Author gwideman
Recipients eric.smith, gregory.p.smith, gwideman, martin.panter, r.david.murray, tim.peters, vstinner
Date 2019-02-21.02:23:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550715825.27.0.121610048108.issue31136@roundup.psfhosted.org>
In-reply-to
Content
Let us be clear here that this is NOT a case where the backslash escapes the subsequent quote. If it WAS such a case, then the sequence \' would leave only the quote in the output string. But it doesn't; it leaves the complete 2-character \' in the output string.
So essentially this is a case of the character sequence \' being given a special status that causes that character pair to have a special meaning in preference to the meaning of the individual characters.
So this IS a bug -- it may be "as designed", but that produces the bug in the name of this feature, "raw string", which is patently misleading and in violation of the principle of least surprise. This is a feature (as the FAQ explains) provided explicitly for developers of regular expression parsers. So at best, these r-strings should be called "regex-oriented" string literals, which can be used elsewhere, at risk of knowing this gotcha.
History
Date User Action Args
2019-02-21 02:23:45gwidemansetrecipients: + gwideman, tim.peters, gregory.p.smith, vstinner, eric.smith, r.david.murray, martin.panter
2019-02-21 02:23:45gwidemansetmessageid: <1550715825.27.0.121610048108.issue31136@roundup.psfhosted.org>
2019-02-21 02:23:45gwidemanlinkissue31136 messages
2019-02-21 02:23:45gwidemancreate