@@ -401,7 +401,7 @@ String literals are described by the following lexical definitions:
401401
402402.. productionlist ::
403403 stringliteral: [`stringprefix `](`shortstring ` | `longstring `)
404- stringprefix: "r" | "R "
404+ stringprefix: "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR "
405405 shortstring: "'" `shortstringitem`* "'" | '"' `shortstringitem`* '"'
406406 longstring: "'''" `longstringitem`* "'''" | '"""' `longstringitem`* '"""'
407407 shortstringitem: `shortstringchar ` | `stringescapeseq `
@@ -441,6 +441,9 @@ instance of the :class:`bytes` type instead of the :class:`str` type. They
441441may only contain ASCII characters; bytes with a numeric value of 128 or greater
442442must be expressed with escapes.
443443
444+ As of Python 3.3 it is possible again to prefix unicode strings with a
445+ ``u `` prefix to simplify maintenance of dual 2.x and 3.x codebases.
446+
444447Both string and bytes literals may optionally be prefixed with a letter ``'r' ``
445448or ``'R' ``; such strings are called :dfn: `raw strings ` and treat backslashes as
446449literal characters. As a result, in string literals, ``'\U' `` and ``'\u' ``
@@ -450,6 +453,11 @@ escapes in raw strings are not treated specially.
450453 The ``'rb' `` prefix of raw bytes literals has been added as a synonym
451454 of ``'br' ``.
452455
456+ .. versionadded :: 3.3
457+ Support for the unicode legacy literal (``u'value' ``) and other
458+ versions were reintroduced to simplify the maintenance of dual
459+ Python 2.x and 3.x codebases. See :pep: `414 ` for more information.
460+
453461In triple-quoted strings, unescaped newlines and quotes are allowed (and are
454462retained), except that three unescaped quotes in a row terminate the string. (A
455463"quote" is the character used to open the string, i.e. either ``' `` or ``" ``.)
0 commit comments