[Python-ideas] Simplifying .format() based string interpolation
Chris Angelico
rosuav at gmail.com
Fri Feb 7 01:11:09 CET 2014
On Fri, Feb 7, 2014 at 10:41 AM, Robert Hölzl <robert.hoelzl at posteo.de> wrote:
> How about introducing new string tokens beginning with 'f',
> which tells the parser to take over that job.
> In this case one simply had to write:
>
> f"{name} is {value} ({value:X} in hex)"
>
> and the parser would replace this by
>
> "{name} is {value} ({value:X} in hex)".format(
> **collections.ChainMap(locals(), globals()) )
PHP programmers would love it. Subsequent maintainers would hate it.
It's way too magical for my liking.
ChrisA
More information about the Python-ideas
mailing list