Hacker News new | past | comments | ask | show | jobs | submit login

Wow, today I learned about f strings. That will make my code so much more readable! And no more annoying bugs because I skipped one of the seven references in the string!



It reads like sarcasm, but then you drop a real benefit. ((Confusion by New Order playing in the background))


No it’s true enthusiasm. The internet has just ruined ! For everyone. :)


Glad to hear you like it. As a fun fact (and self-back patting), it was I who braved the gauntlet at the python-ideas mailing list to get the idea accepted. Eric Smith did everything else so deserves the credit.

Background: turns out that the string prefix was the only ASCII syntax left in Python3, that's why it was chosen. The name "eff string" makes me cringe, but once it stuck there was no stopping it.


> it was I who braved the gauntlet at the python-ideas mailing list to get the idea accepted

That explains why you're all over this post ;)

Fantastic feature, though. Really. Thanks!

Out of curiosity, what name would you have preferred over "f-strings"? "Format strings"? "Interpolation strings"? "I-will-evaluate-expressions-in-curly-braces strings"?


Well, I usually participate in Python threads. This post had only one part on f-strings.

What to call it? Anything I guess. String interpolation is what it is called elsewhere. But the f prefix is what everyone sees, though as mentioned, it is only an implementation detail because other forms of syntax were already spoken for. I personally chose f for "format."

Early on Guido changed the scope to include expressions as well. People were already starting to say "eff string" so I changed my proposal to "e-string" for "expression." I also like the sound of it better, sounds like email, etc. But Guido (and Eric) decided to stick with f. Maybe because Guido learned English later he doesn't realize how unfortunate it sounds. But, years later we use the "iPad" and forget it sounds like a feminine napkin. So, no big deal in the end.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: