[Python-ideas] Maybe allow br"" or rb"" e.g., for bytes regexes in Py3?

Nick Coghlan ncoghlan at gmail.com
Tue Jun 29 14:12:18 CEST 2010


On Tue, Jun 29, 2010 at 6:20 PM, Mark Summerfield <mark at qtrac.eu> wrote:
>    FONTNAME_RE = re.compile(br"/FontName\s+/(\S+)")
>    # or
>    FONTNAME_RE = re.compile(rb"/FontName\s+/(\S+)")
>
> I _slightly_ prefer rb"" to br"" but either would be great:-)

According to my local build, we already picked 'br':

Python 3.2a0 (py3k:81943, Jun 12 2010, 22:02:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "\t"
'\t'
>>> r"\t"
'\\t'
>>> b"\t"
b'\t'
>>> br"\t"
b'\\t'

I installed the system python3 to confirm that this isn't new:

Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> br"\t"
b'\\t'

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list