Skip to content

gh-135676: Lexical analysis: Reword String literals and related sections #135942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 23, 2025
Prev Previous commit
Next Next commit
Use correct Pygments lexer for plain text
  • Loading branch information
encukou committed Jun 25, 2025
commit 80ad85cc286f04a4ac19d03c5f99a9158d15231b
12 changes: 8 additions & 4 deletions Doc/reference/lexical_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ String and Bytes literals
String literals are text enclosed in single quotes (``'``) or double
quotes (``"``). For example:

.. code-block:: plain
.. This is Python code, but we turn off highlighting because as of this
writing, highlighted strings don't look good when there's no code
surrounding them.

.. code-block:: text

"spam"
'eggs'
Expand All @@ -505,7 +509,7 @@ The quote used to start the literal also terminates it, so a string literal
can only contain the other quote (except with escape sequences, see below).
For example:

.. code-block:: plain
.. code-block:: text

'Say "Hello", please.'
"Don't do that!"
Expand All @@ -531,7 +535,7 @@ either ``'`` or ``"``.)

For example:

.. code-block:: plain
.. code-block:: text

"""This is a triple-quoted string with "quotes" inside."""

Expand Down Expand Up @@ -560,7 +564,7 @@ String prefixes
String literals can have an optional :dfn:`prefix` that influences how the literal
is parsed, for example:

.. code-block:: plain
.. code-block:: python

b"data"
f'{result=}'
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy