[Python-ideas] Maybe allow br"" or rb"" e.g., for bytes regexes in Py3?
Stephen J. Turnbull
stephen at xemacs.org
Tue Jun 29 14:34:58 CEST 2010
Mark Summerfield writes:
> Python 3 has two string prefixes r"" for raw strings and b"" for
> bytes.
And you *can* combine them, but it needs to be in the right order
(although I'm not sure that's intentional):
steve at uwakimon ~ $ python3.1
Python 3.1.2 (release31-maint, May 12 2010, 20:15:06)
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> rb"a\rc"
File "<stdin>", line 1
rb"a\rc"
^
SyntaxError: invalid syntax
>>> br"abc"
b'abc'
>>> br"a\rc"
b'a\\rc'
>>>
Watch out for that time machine!
More information about the Python-ideas
mailing list