@@ -109,13 +109,13 @@ Template String Literals
109109
110110This PEP introduces a new string prefix, ``t ``, to define template string literals.
111111These literals resolve to a new type, ``Template ``, found in the standard library
112- module ``<<TBD>> ``.
112+ module ``string.templatelib ``.
113113
114114The following code creates a ``Template `` instance:
115115
116116.. code-block :: python
117117
118- from TBD import Template
118+ from string.templatelib import Template
119119 template = t" This is a template string."
120120 assert isinstance (template, Template)
121121
@@ -134,7 +134,8 @@ see the `Raw Template Strings`_ section below for more information.
134134The ``Template `` Type
135135---------------------
136136
137- Template strings evaluate to an instance of a new immutable type, ``<<TBD>>.Template ``:
137+ Template strings evaluate to an instance of a new immutable type,
138+ ``string.templatelib.Template ``:
138139
139140.. code-block :: python
140141
@@ -192,7 +193,7 @@ The ``Interpolation`` Type
192193--------------------------
193194
194195The ``Interpolation `` type represents an expression inside a template string.
195- Like ``Template ``, it is a new class found in the ``<<TBD>> `` module:
196+ Like ``Template ``, it is a new class found in the ``string.templatelib `` module:
196197
197198.. code-block :: python
198199
@@ -315,7 +316,7 @@ interpolations in uppercase:
315316
316317.. code-block :: python
317318
318- from TBD import Template, Interpolation
319+ from string.templatelib import Template, Interpolation
319320
320321 def lower_upper (template : Template) -> str :
321322 """ Render static parts lowercased and interpolations uppercased."""
@@ -506,7 +507,7 @@ specifiers like ``:.2f``. The full code is fairly simple:
506507
507508.. code-block :: python
508509
509- from TBD import Template, Interpolation
510+ from string.templatelib import Template, Interpolation
510511
511512 def convert (value : object , conv : Literal[" a" , " r" , " s" ] | None ) -> object :
512513 if conv == " a" :
@@ -579,7 +580,7 @@ We can implement an improved version of ``StructuredMessage`` using template str
579580.. code-block :: python
580581
581582 import json
582- from TBD import Interpolation, Template
583+ from string.templatelib import Interpolation, Template
583584 from typing import Mapping
584585
585586 class TemplateMessage :
@@ -636,7 +637,7 @@ and a ``ValuesFormatter`` for JSON output:
636637
637638 import json
638639 from logging import Formatter, LogRecord
639- from TBD import Interpolation, Template
640+ from string.templatelib import Interpolation, Template
640641 from typing import Any, Mapping
641642
642643
@@ -820,7 +821,7 @@ best practice for many template function implementations:
820821
821822.. code-block :: python
822823
823- from TBD import Template, Interpolation
824+ from string.templatelib import Template, Interpolation
824825
825826 def process (template : Template) -> Any:
826827 for item in template:
@@ -1228,14 +1229,8 @@ The Final Home for ``Template`` and ``Interpolation``
12281229
12291230Previous versions of this PEP proposed placing the ``Template `` and
12301231``Interpolation `` types in: ``types ``, ``collections ``, ``collections.abc ``,
1231- and even in a new top-level module, ``templatelib ``. As of this writing, no core
1232- team consensus has emerged on the final location for these types. The current
1233- PEP leaves this open for a final decision.
1234-
1235- One argument in favor of a new top-level ``templatelib `` module is that it would
1236- allow for future addition of related methods (like ``convert() ``) and for
1237- potential future template processing code to be added to submodules
1238- (``templatelib.shell ``, etc.).
1232+ and even in a new top-level module, ``templatelib ``. The final decision was to
1233+ place them in ``string.templatelib ``.
12391234
12401235
12411236Enable Full Reconstruction of Original Template Literal
0 commit comments