
Sorry, I meant to write 'foo'r'\bar' at the end of my previous message. On Thu, Jul 23, 2015 at 10:08 PM, Alexander Belopolsky < alexander.belopolsky@gmail.com> wrote:
On Thu, Jul 23, 2015 at 10:22 AM, Steven D'Aprano <steve@pearwood.info> wrote:
I don't think I want this behaviour:
f'{spam}' '{eggs}' => format(spam) + '{eggs}'
for two reasons. Firstly, I already have (at least!) one way of getting that behaviour, such as explicit + concatenation as above.
Secondly, it feels that this does the concatenation in the wrong order. Implicit concatenation occurs as early as possible in every other case. But here, we're delaying the concatenation until after the format. So this feels wrong to me.
(Again, I'm talking semantics, not implementation. Clever tricks with escaping the brackets don't matter.)
I don't know what you would call "Clever tricks with escaping", but I would expect
f'{spam}' '{eggs}' => '{spam}{{eggs}}'.format(**ChainMap(locals(), globals())
just as
'foo'r'bar' => 'foo\\bar'