Message163062
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. |
|
Date |
User |
Action |
Args |
2012-06-17 12:17:39 | ncoghlan | set | recipients:
+ ncoghlan |
2012-06-17 12:17:39 | ncoghlan | set | messageid: <1339935459.47.0.228207726214.issue15096@psf.upfronthosting.co.za> |
2012-06-17 12:17:38 | ncoghlan | link | issue15096 messages |
2012-06-17 12:17:37 | ncoghlan | create | |
|