Skip to content

Commit 15dd810

Browse files
committed
Take care of @hugovk's suggestions.
1 parent 72b36fe commit 15dd810

File tree

9 files changed

+26
-29
lines changed

9 files changed

+26
-29
lines changed

Doc/glossary.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ Glossary
462462
core and with user code.
463463

464464
f-string
465-
String literals prefixed with ``'f'`` or ``'F'`` are commonly called
465+
String literals prefixed with ``f`` or ``F`` are commonly called
466466
"f-strings" which is short for
467467
:ref:`formatted string literals <f-strings>`. See also :pep:`498`.
468468

@@ -1318,7 +1318,7 @@ Glossary
13181318
See also :term:`borrowed reference`.
13191319

13201320
t-string
1321-
String literals prefixed with ``'t'`` or ``'T'`` are commonly called
1321+
String literals prefixed with ``t`` or ``T`` are commonly called
13221322
"t-strings" which is short for
13231323
:ref:`template string literals <t-strings>`.
13241324

Doc/library/ast.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Literals
291291
* -1: no formatting
292292
* 115: ``!s`` string formatting
293293
* 114: ``!r`` repr formatting
294-
* 97: ``!a`` ascii formatting
294+
* 97: ``!a`` ASCII formatting
295295

296296
* ``format_spec`` is a :class:`JoinedStr` node representing the formatting
297297
of the value, or ``None`` if no format was specified. Both

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ iterations of the loop.
11471147

11481148
If ``format >> 2`` is non-zero, it indicates that the interpolation
11491149
contains a conversion. The value of ``format >> 2`` is the conversion type
1150-
(e.g. ``0`` for no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and
1150+
(``0`` for no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and
11511151
``3`` for ``!a``)::
11521152

11531153
conversion = format >> 2

Doc/library/string.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ Template strings ($-strings)
799799

800800
The feature described here was introduced in Python 2.4. It is unrelated
801801
to, and should not be confused with, the newer
802-
:ref:`template strings <template-strings>` feature and
802+
:ref:`template strings <template-strings>` and
803803
:ref:`t-string literal syntax <t-strings>` introduced in Python 3.14.
804804
T-string literals evaluate to instances of a different
805805
:class:`~string.templatelib.Template` class, found in the
@@ -983,9 +983,3 @@ Helper functions
983983
or ``None``, runs of whitespace characters are replaced by a single space
984984
and leading and trailing whitespace are removed, otherwise *sep* is used to
985985
split and join the words.
986-
987-
988-
989-
.. toctree::
990-
991-
string.templatelib.rst

Doc/library/string.templatelib.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:mod:`!string.templatelib` --- Templates and Interpolations for t-strings
1+
:mod:`!string.templatelib` --- Templates and interpolations for t-strings
22
=========================================================================
33

44
.. module:: string.templatelib
@@ -11,9 +11,9 @@
1111

1212
.. seealso::
1313

14-
:ref:`T-strings tutorial <tut-t-strings>`
15-
:ref:`Format strings <f-strings>`
16-
:ref:`T-string literal syntax <t-strings>`
14+
* :ref:`T-strings tutorial <tut-t-strings>`
15+
* :ref:`Format strings <f-strings>`
16+
* :ref:`T-string literal syntax <t-strings>`
1717

1818

1919
.. _template-strings:
@@ -109,6 +109,8 @@ reassigned.
109109

110110
>>> t"".strings
111111
('',)
112+
>>> t"".values
113+
()
112114
>>> t"{'cheese'}".strings
113115
('', '')
114116
>>> t"{'cheese'}".values
@@ -191,10 +193,10 @@ reassigned.
191193
:param value: The evaluated, in-scope result of the interpolation.
192194
:type value: object
193195

194-
:param expression: The text of a valid Python expression, or an empty string
196+
:param expression: The text of a valid Python expression, or an empty string.
195197
:type expression: str
196198

197-
:param conversion: The optional :ref:`conversion <formatstrings>` to be used, one of r, s, and a,.
199+
:param conversion: The optional :ref:`conversion <formatstrings>` to be used, one of r, s, and a.
198200
:type conversion: Literal["a", "r", "s"] | None
199201

200202
:param format_spec: An optional, arbitrary string used as the :ref:`format specification <formatspec>` to present the value.
@@ -229,8 +231,8 @@ reassigned.
229231

230232
.. property:: conversion
231233

232-
:returns: The conversion to apply to the value, or ``None``
233-
:rtype: Literal["a", "r", "s"] | None
234+
:returns: The conversion to apply to the value, or ``None``.
235+
:rtype: ``Literal["a", "r", "s"] | None``
234236

235237
The :attr:`!Interpolation.conversion` is the optional conversion to apply
236238
to the value:

Doc/library/text.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Python's built-in string type in :ref:`textseq`.
1616
.. toctree::
1717

1818
string.rst
19+
string.templatelib.rst
1920
re.rst
2021
difflib.rst
2122
textwrap.rst

Doc/reference/lexical_analysis.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ escapes are not treated specially.
561561
single: f'; formatted string literal
562562
single: f"; formatted string literal
563563

564-
A string literal with ``'f'`` or ``'F'`` in its prefix is a
565-
:dfn:`formatted string literal`; see :ref:`f-strings`. The ``'f'`` may be
566-
combined with ``'r'``, but not with ``'b'`` or ``'u'``, therefore raw
564+
A string literal with ``f`` or ``F`` in its prefix is a
565+
:dfn:`formatted string literal`; see :ref:`f-strings`. The ``f`` may be
566+
combined with ``r``, but not with ``b`` or ``u``, therefore raw
567567
formatted strings are possible, but formatted bytes literals are not.
568568

569569
In triple-quoted literals, unescaped newlines and quotes are allowed (and are
@@ -756,7 +756,7 @@ f-strings
756756
.. versionadded:: 3.6
757757

758758
A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal
759-
that is prefixed with ``'f'`` or ``'F'``. These strings may contain
759+
that is prefixed with ``f`` or ``F``. These strings may contain
760760
replacement fields, which are expressions delimited by curly braces ``{}``.
761761
While other string literals always have a constant value, formatted strings
762762
are really expressions evaluated at run time.
@@ -922,7 +922,7 @@ t-strings
922922
.. versionadded:: 3.14
923923

924924
A :dfn:`template string literal` or :dfn:`t-string` is a string literal
925-
that is prefixed with ``'t'`` or ``'T'``. These strings follow the same
925+
that is prefixed with ``t`` or ``T``. These strings follow the same
926926
syntax and evaluation rules as :ref:`formatted string literals <f-strings>`, with
927927
the following differences:
928928

@@ -950,9 +950,9 @@ the following differences:
950950
:attr:`~string.templatelib.Template.interpolations` attribute will also
951951
contain an ``Interpolation`` instance for the expression. By default, the
952952
:attr:`~string.templatelib.Interpolation.conversion` attribute will be set to
953-
``'r'`` (i.e. :func:`repr`), unless there is a conversion explicitly specified
954-
(in which case it overrides the default) or a format specifier is provided (in
955-
which case, the ``conversion`` defaults to ``None``).
953+
``'r'`` (that is, :func:`repr`), unless there is a conversion explicitly
954+
specified (in which case it overrides the default) or a format specifier is
955+
provided (in which case, the ``conversion`` defaults to ``None``).
956956

957957

958958
.. _numbers:

Doc/sphinx-warnings.txt

Whitespace-only changes.

Doc/tutorial/inputoutput.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ representation of the HTML:
343343
...
344344
>>> def parse_html(template: Template) -> Element:
345345
... """
346-
... Uses python's built-in HTMLParser to parse the template,
346+
... Uses Python's built-in HTMLParser to parse the template,
347347
... handle any interpolated values, and return a tree of
348348
... Element instances.
349349
... """
350-
... pass
350+
... ...
351351
...
352352

353353
A full implementation of this function would be quite complex and is not

0 commit comments

Comments
 (0)