[Python-ideas] String interpolation for all literal strings
Chris Angelico
rosuav at gmail.com
Sun Aug 9 01:16:48 CEST 2015
On Sun, Aug 9, 2015 at 7:34 AM, Eric V. Smith <eric at trueblade.com> wrote:
> Yes, there's been a fair amount of discussion on this. The trick would
> be finding a place in the grammar that allows enough, but not too much
> expressiveness. I personally think it should just be a code review item.
> Is there really anything wrong with:
>
>>>> msg = 'apple'
>>>> f'The sign said "{msg.upper()}".'
> 'The sign said "APPLE".'
Not in my opinion. I know it's always possible to make something
_more_ powerful later on, and it's hard to make it _less_ powerful,
but in this case, I'd be happy to see this with the full power of an
expression. Anything that you could put after "lambda:" should be
valid here, which according to Grammar/grammar is called "test".
ChrisA
More information about the Python-ideas
mailing list