[New-bugs-announce] [issue15096] Drop support for the "ur" string prefix

Nick Coghlan report at bugs.python.org
Sun Jun 17 14:17:39 CEST 2012


New submission from Nick Coghlan <ncoghlan at gmail.com>:

When PEP 414 restored support for explicit Unicode literals in Python 3, the "ur" string prefix was deemed to be a synonym for the "r" prefix.

However, "ur" in 2.x was only kinda-sorta-raw, since it still supported Unicode escapes:

$ python
Python 2.7.3 (default, Apr 30 2012, 21:18:11) 
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print(ur'\u03B3')
γ

By contrast, they really are raw strings in 3.x, because the default UTF-8 source code encoding allows arbitrary Unicode characters to be included directly in the literal:

$ ./python
Python 3.3.0a4+ (default:cfbf6aa5c9e3+, Jun 17 2012, 15:25:45) 
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> r"γ"
'γ'
>>> "\U000003B3"
'γ'
>>> r"\U000003B3"
'\\U000003B3'
>>> ur"\U000003B3"
'\\U000003B3'

Rather than reintroducing this weird legacy not-really-raw string behaviour, I'd prefer to revert this aspect of the PEP 414 changes completely.

----------
components: Interpreter Core
messages: 163062
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Drop support for the "ur" string prefix
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15096>
_______________________________________


More information about the New-bugs-announce mailing list