[Python-Dev] ur'string literal' in 3.3: make same as in 2.x? (original) (raw)
Terry Reedy tjreedy at udel.edu
Wed May 30 18:45:29 CEST 2012
- Previous message: [Python-Dev] Python Language Summit, Florence, July 2012
- Next message: [Python-Dev] ur'string literal' in 3.3: make same as in 2.x?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In 2.7, 'r' and 'ur' string literal prefixes have different effects:
"When an 'r' or 'R' prefix is present, a character following a backslash is included in the string without change, and all backslashes are left in the string."
"When an 'r' or 'R' prefix is used in conjunction with a 'u' or 'U' prefix, then the \uXXXX and \UXXXXXXXX escape sequences are processed while all other backslashes are left in the string."
When 'u' was deleted in 3.0, the first meaning was kept.
Was any thought given to restoring this difference in 3.3, along with restoring 'u', so that code using 'ur' prefixes would truly be cross-compatible? (I checked, and it has not been.) Cross-compatibility is the point of adding 'u' back, and this would give 'u' prefixes an actual, useful function even in Python 3.
This issue came up today in python-list thread 'python3 raw strings and \u escapes' by 'rurpy', who uses 'ur' for re strings with unicode chars and is trying to port his code to 3.x.
-- Terry Jan Reedy
- Previous message: [Python-Dev] Python Language Summit, Florence, July 2012
- Next message: [Python-Dev] ur'string literal' in 3.3: make same as in 2.x?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]