ur'foo' syntax under Python 3

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Feb 8 20:50:43 CET 2014

On 08/02/2014 19:38, Lele Gaifax wrote:
> Hi all,
> I'm using Python 3.3, and I was surprised to realize that it does not
> support the old Python 2 syntax ur"literal-raw-unicode-strings".
> Is there any trick to write such literals in a Python2+3 compatible
> source?
> Is there a rationale behind the invalid syntax or is it just a glitch?
> thanks in advance,
> bye, lele.


"Both string and bytes literals may optionally be prefixed with a letter 
'r' or 'R'; such strings are called raw strings and treat backslashes as 
literal characters. As a result, in string literals, '\U' and '\u' 
escapes in raw strings are not treated specially. Given that Python 
2.x’s raw unicode literals behave differently than Python 3.x’s the 'ur' 
syntax is not supported."

My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

This email is free from viruses and malware because avast! Antivirus protection is active.

More information about the Python-list mailing list