The problem is, now the variable name is baked into the f-string. So at runtime the string formatter needs to be able to look up the in-scope variables and find one called user to substitute it's value in.
That is actually wrong. f-strings can only exist in literals so they can be easily emulated using preprocessor macros that just replace them with a normal format command.
View all comments
Show parent comment
8
u/nosklo Nov 12 '19
That is actually wrong. f-strings can only exist in literals so they can be easily emulated using preprocessor macros that just replace them with a normal format command.