Skip to content

Commit 21d337c

Browse files
committed
More!
1 parent a796f5d commit 21d337c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -923,20 +923,19 @@ t-strings
923923

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

929929
- Rather than evaluating to a ``str`` object, t-strings evaluate to a
930930
:class:`~string.templatelib.Template` object from the
931931
:mod:`string.templatelib` module.
932932

933-
- Evaluated expressions are *not* formatted using the
934-
:func:`format` protocol; :meth:`~object.__format__` is *not* invoked. Instead,
935-
the expressions are evaluated and a new :class:`~string.templatelib.Interpolation``
936-
object (also from the :mod:`string.templatelib` module) is created, which
937-
contains the evaluated value of the expression. That ``Interpolation`` object
938-
is found in the containing ``Template``.
933+
- The :func:`format` protocol is not used. Instead, the format specifier and
934+
conversions (if any) are passed to a new :class:`~string.templatelib.Interpolation`
935+
object that is created for each evaluated expression.
939936

937+
- Format specifiers containing nested replacement fields are evaluated eagerly,
938+
prior to being passed to the :class:`~string.templatelib.Interpolation` object.
940939

941940

942941
.. _numbers:

Doc/sphinx-warnings.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)