On Thu, Jun 10, 2021 at 7:10 AM Chris Angelico <[email protected]> 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:
https://google.github.io/styleguide/pyguide.html#3101-logging
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/BP75MZ4ZWZTLNZR7G6ICVYZXBXQC4EZI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to