Formalizing f-strings
Formalizing f-strings
Posted Jan 11, 2023 11:54 UTC (Wed) by eru (subscriber, #2753)Parent article: Formalizing f-strings
Nice work, but not sure if this is so useful in real life. f-strings (and similar features in other programming languages) turn the code unreadable, if the expression being expanded is complex (basically anything beyond a variable reference or a very simple expression). Anything more complicated is best handled by introducing auxiliary variables. Or just by using the string concatenation operator.
Posted Jan 11, 2023 17:53 UTC (Wed)
by iabervon (subscriber, #722)
[Link]
For that matter, what constitutes "a very simple expression" is really dependent on the language's common idioms and the capabilities of widely-deployed syntax highlighting. Comma-separated strings from a list is probably that idiomatic in Python, especially if the ".join(" portion doesn't appear in the string literal color, and it's a common thing to only want for a message anyway.
Formalizing f-strings