@@ -443,7 +443,7 @@ instance of the :class:`bytes` type instead of the :class:`str` type. They
443
443
may only contain ASCII characters; bytes with a numeric value of 128 or greater
444
444
must be expressed with escapes.
445
445
446
- As of Python 3.3 it is possible again to prefix unicode strings with a
446
+ As of Python 3.3 it is possible again to prefix string literals with a
447
447
``u `` prefix to simplify maintenance of dual 2.x and 3.x codebases.
448
448
449
449
Both string and bytes literals may optionally be prefixed with a letter ``'r' ``
@@ -453,24 +453,24 @@ escapes in raw strings are not treated specially. Given that Python 2.x's raw
453
453
unicode literals behave differently than Python 3.x's the ``'ur' `` syntax
454
454
is not supported.
455
455
456
- .. versionadded :: 3.3
457
- The ``'rb' `` prefix of raw bytes literals has been added as a synonym
458
- of ``'br' ``.
456
+ .. versionadded :: 3.3
457
+ The ``'rb' `` prefix of raw bytes literals has been added as a synonym
458
+ of ``'br' ``.
459
459
460
- .. versionadded :: 3.3
461
- Support for the unicode legacy literal (``u'value' ``) was reintroduced
462
- to simplify the maintenance of dual Python 2.x and 3.x codebases.
463
- See :pep: `414 ` for more information.
460
+ .. versionadded :: 3.3
461
+ Support for the unicode legacy literal (``u'value' ``) was reintroduced
462
+ to simplify the maintenance of dual Python 2.x and 3.x codebases.
463
+ See :pep: `414 ` for more information.
464
464
465
- In triple-quoted strings , unescaped newlines and quotes are allowed (and are
466
- retained), except that three unescaped quotes in a row terminate the string . (A
467
- "quote" is the character used to open the string , i.e. either ``' `` or ``" ``.)
465
+ In triple-quoted literals , unescaped newlines and quotes are allowed (and are
466
+ retained), except that three unescaped quotes in a row terminate the literal . (A
467
+ "quote" is the character used to open the literal , i.e. either ``' `` or ``" ``.)
468
468
469
469
.. index :: physical line, escape sequence, Standard C, C
470
470
471
- Unless an ``'r' `` or ``'R' `` prefix is present, escape sequences in strings are
472
- interpreted according to rules similar to those used by Standard C. The
473
- recognized escape sequences are:
471
+ Unless an ``'r' `` or ``'R' `` prefix is present, escape sequences in string and
472
+ bytes literals are interpreted according to rules similar to those used by
473
+ Standard C. The recognized escape sequences are:
474
474
475
475
+-----------------+---------------------------------+-------+
476
476
| Escape Sequence | Meaning | Notes |
@@ -547,20 +547,20 @@ Notes:
547
547
.. index :: unrecognized escape sequence
548
548
549
549
Unlike Standard C, all unrecognized escape sequences are left in the string
550
- unchanged, i.e., *the backslash is left in the string *. (This behavior is
550
+ unchanged, i.e., *the backslash is left in the result *. (This behavior is
551
551
useful when debugging: if an escape sequence is mistyped, the resulting output
552
552
is more easily recognized as broken.) It is also important to note that the
553
553
escape sequences only recognized in string literals fall into the category of
554
554
unrecognized escapes for bytes literals.
555
555
556
- Even in a raw string, string quotes can be escaped with a backslash, but the
557
- backslash remains in the string ; for example, ``r"\"" `` is a valid string
556
+ Even in a raw literal, quotes can be escaped with a backslash, but the
557
+ backslash remains in the result ; for example, ``r"\"" `` is a valid string
558
558
literal consisting of two characters: a backslash and a double quote; ``r"\" ``
559
559
is not a valid string literal (even a raw string cannot end in an odd number of
560
- backslashes). Specifically, *a raw string cannot end in a single backslash *
560
+ backslashes). Specifically, *a raw literal cannot end in a single backslash *
561
561
(since the backslash would escape the following quote character). Note also
562
562
that a single backslash followed by a newline is interpreted as those two
563
- characters as part of the string , *not * as a line continuation.
563
+ characters as part of the literal , *not * as a line continuation.
564
564
565
565
566
566
.. _string-catenation :
0 commit comments