3 ms·
I don't understand the f-string hate. f-strings put the value in the output string exactly where the value should be. Massive win for contextual awareness, no
by jonathaneunice 1y ago
I don't understand the f-string hate.
f-strings put the value in the output string exactly where the value should be. Massive win for contextual awareness, no need to count ...3, 4, okay what's the position 4 value over on the right, does it match up?? And they use classic Python string formatting commands, except the = operator which makes them even better with a "name the variable, show its value in a concise way" option. What's not to like?
(And if you don't like them, uh...they're not mandatory. Just don't use them.)
- somat 1y agoIf i had to guess, the implicit access to all your vars feels gross to some, it's why I don't use them. I mean they are probably fine, like you said, puts the symbol right where you want it. It just never felt right to me. so I keep up the double dance of explicate format() calls. It is probably some sort of deep seated printf() based trauma.
- danwills 1y agoI recently swapped from adding strings together (just what I've always done) to f-strings and I'm not looking back! I even get to keep the idea of being able to read the vars in-place in the string which is certainly the last thing that I needed to be happy to use them! Full convert now!