Am Fr., 11. Juni 2021 um 03:17 Uhr schrieb Stephan Hoyer <shoyer@gmail.com>:
On Thu, Jun 10, 2021 at 7:10 AM Chris Angelico <rosuav@gmail.com> wrote:
This proposal is basically for a way to take an f-string-like
construct and, instead of calling format() on each of the values and
joining them together into a string, you do something else with it. Or
from a language perspective, you package it all up and hand it to a
custom function.

So it's basically an f-string minus the final step - which is why PEP
501 described f-strings in terms of interpolated strings.

Unevaluated f-strings is a nice way to think about this functionality.

Another use-case that comes to mind is logging. The Google Python style guide says not to use f-strings, for example, because it wants to be able to collect the unexpanded pattern strings and not waste time rendering unlogged messages:


Thank you Stephan for this feedback. I added Logging to the draft: https://github.com/guettli/peps/blob/master/pep-9999.rst#logging

Regards,
  Thomas