LWN.net (RSS Feed) on Nostr: A revamped Python string-formatting proposal The proposal to add a more general ...
A revamped Python string-formatting proposal
The proposal to add a more general facility for string formatting to
Python, which we https://lwn.net/Articles/985346/
in August 2024,
has changed a great deal since, so it merits another look. The
changes take multiple forms: a new title for <a href="https://peps.python.org/pep-0750/"; rel="nofollow">PEP
750</a> ("Template Strings"), a different mechanism for creating and using templates,
a new Template type to hold them, and several additional authors for the PEP.
Meanwhile, one controversial part of the original proposal, lazy evaluation
of the interpolated values, has been changed so that it requires an
explicit opt-in (via https://docs.python.org/3.8/tutorial/controlflow.html#lambda-expressions
);
template strings are a generalization of https://lwn.net/Articles/919426/
and lazy evaluation was seen by some
as a potentially confusing departure from their behavior.
https://lwn.net/Articles/1005000/
The proposal to add a more general facility for string formatting to
Python, which we https://lwn.net/Articles/985346/
in August 2024,
has changed a great deal since, so it merits another look. The
changes take multiple forms: a new title for <a href="https://peps.python.org/pep-0750/"; rel="nofollow">PEP
750</a> ("Template Strings"), a different mechanism for creating and using templates,
a new Template type to hold them, and several additional authors for the PEP.
Meanwhile, one controversial part of the original proposal, lazy evaluation
of the interpolated values, has been changed so that it requires an
explicit opt-in (via https://docs.python.org/3.8/tutorial/controlflow.html#lambda-expressions
);
template strings are a generalization of https://lwn.net/Articles/919426/
and lazy evaluation was seen by some
as a potentially confusing departure from their behavior.
https://lwn.net/Articles/1005000/