> But this is adding a new convention for method calls.
It
is simply a new kind of literal. Nothing more, nothing less. f is not a
method in this design, and nothing requires it to be. I didn't make
that clear originally, sorry.
"this is a string" is a literal
3 is a literal
f"this is a ${object}" would be a new kind of literal, just like
u"abc" is a Unicode string literal in C and C++ and
r"\n" is a raw string literal in Python and
0x6 is a hexidecimal number in many languages
'f' in the context of f-strings is a literal prefix that qualifies the interpretation of the literal.
> Would this look up instance vars in the local scope?
I
think so, it would be evaluated at runtime. I can imagine that under
the hood it would be implemented as a new literal type that compiles to a
normal string literal + call to `format`.
> Sorry my python is so rusty, but why would % require you to rewrite
> sentences in % order? If we need to do this in python they're doing %
> wrong in the first place.
I think the point is that in this notation the value that is substituted for % is far removed from its point of insertion, which requires you to read back and forth when understanding the code. Perhaps read the linked PEP article; I believe Stefaan was more or less paraphrasing that.
-Brian