A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-August/141169.html below:

[Python-Dev] PEP-498: Literal String Formatting

[Python-Dev] PEP-498: Literal String FormattingBarry Warsaw barry at python.org
Mon Aug 10 13:48:54 CEST 2015
On Aug 09, 2015, at 06:14 PM, David Mertz wrote:

>That said, there *is* one small corner where I believe f-strings add
>something helpful to the language.  There is no really concise way to spell:
>
>  collections.ChainMap(locals(), globals(), __builtins__.__dict__).
>
>If we could spell that as, say `lgb()`, that would let str.format() or
>%-formatting pick up the full "what's in scope".  To my mind, that's the
>only good thing about the f-string idea.

That would certainly be useful to avoid sys._getframe() calls in my library,
although I'd probably want the third argument to be optional (I wouldn't use
it).

If '{foo}' or '${foo}' syntax is adopted (with no allowance for '$foo'), it's
very unlikely I'd use that over string.Template for internationalization, but
the above would still be useful.

Cheers,
-Barry
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4