r'\' - python parser bug?

Fredrik Lundh fredrik at pythonware.com
Tue May 25 11:12:22 EDT 2004


Tim Peters wrote:

> Yup.  Right now all tools (including Python itself) that scan over strings
> in Python source can (and usually do) treat backslashes identically, whether
> in loops or in regexps.

Or in other words, the point here is that the prefix flag (u, r, whatever) doesn't
affect how a string literal is *parsed*.  When the parser sees a backslash inside
a string literal, it always skips the next character.  There's no separate grammar
for "raw string literals".

</F>







More information about the Python-list mailing list