
On 24.07.2015 04:16, Chris Angelico wrote:
syntax, not something you apply to a string. You can't do this:
fmt = "Hello, {place}!" place = "world" print(f fmt)
If f were an operator, with precedence, then this would work. But it doesn't, for the same reason that this doesn't work:
path = "C:\users\nobody" fixed_path = r path
These are pieces of syntax, and syntax is at a level prior to all considerations of operator precedence.
You might be true about this. I think he just used operators as some sort of analogy to figure out which comes first: concat or format. My semantic opinion on this: first format, then concat. Why? Because '...' is a atomic thing and shouldn't be modified by its peer elements (i.e. strings). About implementation: the idea of first concat with **implicit** escaping braces illustrated another minor use case for me: no need to escape braces. f'Let {var} = ''{x | x > 3}' This way, the f syntax would really help readability when it comes to situations where many braces are used.