From b5fe80ab455f882752d864b697a465a4024448e2 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 5 Aug 2024 21:50:04 +0300 Subject: [PATCH 1/3] gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` --- Doc/reference/lexical_analysis.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 594fc713aa8edd..e1931d3195706b 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -503,7 +503,8 @@ must be expressed with escapes. single: r"; raw string literal Both string and bytes literals may optionally be prefixed with a letter ``'r'`` -or ``'R'``; such strings are called :dfn:`raw strings` and treat backslashes as +or ``'R'``; such objects are called :dfn:`raw strings` +and :dfn:`raw bytes` respectively 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 From 79275301faf9c8e6989976cfa2b8731ce6e2be24 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 8 Aug 2024 15:41:37 +0300 Subject: [PATCH 2/3] Address review --- Doc/reference/lexical_analysis.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index e1931d3195706b..af51901b93da33 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -503,12 +503,10 @@ must be expressed with escapes. single: r"; raw string literal Both string and bytes literals may optionally be prefixed with a letter ``'r'`` -or ``'R'``; such objects are called :dfn:`raw strings` -and :dfn:`raw bytes` respectively 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. +or ``'R'``; such constructs are called :dfn:`raw string literals` +and :dfn:`raw bytes literals` respectively and treat backslashes as +literal characters. As a result, in raw string literals ``'\U'`` and ``'\u'`` +escapes are not treated specially. .. versionadded:: 3.3 The ``'rb'`` prefix of raw bytes literals has been added as a synonym From 151eda5a60c3c788ccbbec9d849614ecec777970 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:45:11 +0100 Subject: [PATCH 3/3] Update Doc/reference/lexical_analysis.rst --- Doc/reference/lexical_analysis.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index af51901b93da33..635d36537a0678 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -505,7 +505,7 @@ must be expressed with escapes. Both string and bytes literals may optionally be prefixed with a letter ``'r'`` or ``'R'``; such constructs are called :dfn:`raw string literals` and :dfn:`raw bytes literals` respectively and treat backslashes as -literal characters. As a result, in raw string literals ``'\U'`` and ``'\u'`` +literal characters. As a result, in raw string literals, ``'\U'`` and ``'\u'`` escapes are not treated specially. .. versionadded:: 3.3