[$] Formalizing f-strings

Post Syndicated from original https://lwn.net/Articles/919426/

Python’s formatted strings, or “f-strings”, came relatively late to the
language, but have become a popular feature. F-strings allow a compact
representation for the common task of interpolating program data into
strings, often in order to output them in some fashion. Some
restrictions were placed on f-strings to simplify the implementation of
them, but those restrictions are not really needed anymore and, in
fact, are complicating the CPython parser. That has led to a Python
Enhancement Proposal (PEP) to formalize the syntax of f-strings for the
benefit of Python users while simplifying the maintenance of the
interpreter itself.