A bug for raw string literals in Py3k?

MRAB python at mrabarnett.plus.com
Mon Nov 1 04:51:57 CET 2010

On 01/11/2010 03:30, Yingjie Lan wrote:
>>>> All backslashes in raw string literals are
>> interpreted literally.
>>>> (seehttp://docs.python.org/release/3.0.1/whatsnew/3.0.html):
>>> All backslashes in syntactically-correct raw string
>> literals are interpreted literally.
>> That's a good way of putting it.
> Syntactical correctness obviously depends on the syntax specification.
> To cancle the special meaning of ALL backlashes in a raw string literal
> makes a lot of sense to me. Currently, the behavior of backslashes
> in a raw string literal is rather complicated I think.
> In fact, the backlashes can still escape quotes in a raw string,
> and one the other hand, it also remains in the string -- I'm
> wondering what kind of use case is there to justify such a behavior?
> Surely, my experience is way too limited to make a solid judgement,
> I Hope others would shed light on this issue.
It has been discussed briefly here: http://bugs.python.org/issue1271

According to msg56377, the behaviour is "optimal" for regular
expressions. Well, I use regular expressions a lot, and I still think
it's a nuisance!

More information about the Python-list mailing list