Skip to content

Commit 4ce7da5

Browse files
committed
Clean up make_alas
1 parent 5e18658 commit 4ce7da5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

peps/pep-0750.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,15 +1049,15 @@ a ``Template`` instance:
10491049

10501050
.. code-block:: python
10511051
1052-
def make_alas(*, cheese: str) -> Template:
1052+
def make_template(*, cheese: str) -> Template:
10531053
return t"We're all out of {cheese}."
10541054
1055-
alas_t = make_alas(cheese="Red Leicester")
1055+
template = make_template(cheese="Red Leicester")
10561056
# Using the f() function from the f-string example, above
1057-
assert f(alas_t) == "We're all out of Red Leicester."
1057+
assert f(template) == "We're all out of Red Leicester."
10581058
1059-
The ``make_alas()`` function itself can be thought of as analogous to the
1060-
format string. The call to ``make_alas()`` is analogous to the call to
1059+
The ``make_template()`` function itself can be thought of as analogous to the
1060+
format string. The call to ``make_template()`` is analogous to the call to
10611061
:meth:`str.format`.
10621062

10631063
Of course, it is common to load format strings from external sources like a
@@ -1072,10 +1072,10 @@ old-style format string and returns an equivalent ``Template`` instance:
10721072
...
10731073
10741074
# Load this from a file, database, etc.
1075-
alas_fmt = "We're all out of {cheese}."
1076-
alas_t = from_format(alas_fmt, cheese="Red Leicester")
1075+
fmt = "We're all out of {cheese}."
1076+
template = from_format(fmt, cheese="Red Leicester")
10771077
# Using the f() function from the f-string example, above
1078-
assert f(alas_t) == "We're all out of Red Leicester."
1078+
assert f(template) == "We're all out of Red Leicester."
10791079
10801080
This is a powerful pattern that allows developers to use template strings in
10811081
places where they might have previously used format strings. A full implementation

0 commit comments

Comments
 (0)