[Python-ideas] Let’s make escaping in f-literals impossible

Steven D'Aprano steve at pearwood.info
Tue Aug 30 13:30:27 EDT 2016


On Tue, Aug 30, 2016 at 11:02:25AM +0000, Philipp A. wrote:
> Hi Eric,
> 
> Very cool of you to get this going!
> 
> I hope the outcome is to ban escapes within braced code parts of f-literals
> for 3.6 and add them “the right way” in 3.7: f'foo{ bar['\n'] }baz'

That looks like you are doing a key lookup on bar:

bar = {'\n': 'something'}
f'foo{ bar['\n'] }baz'

looks like it will return 'foosomethingbaz'. I expect that syntax will 
confuse an awful lot of people.


-- 
Steve


More information about the Python-ideas mailing list