3 ms·
Take a look at flynt, a tool that can convert older string formatting code to the newer fstring style. I've found it very helpful! https://github.com/ikamensh/
by matt_trentini 6y ago
Take a look at flynt, a tool that can convert older string formatting code to the newer fstring style. I've found it very helpful!
https://github.com/ikamensh/flynt https://github.com/ikamensh/flynt
- aidos 6y agoCan confirm. I replaced 1.5k instances in our code base in seconds using flynt and it knew the ones that couldn't be swapped out directly. Really great tool. You only ever need it once in your life, but that one time it's amazing.
- andrewem 6y agoHaving not written Python in a long time until recently, I discovered fstrings. Are they the best choice for (nearly all) string formatting at least in new code? They seem to work pretty similarly to eg Ruby’s string interpolation.
- pythonslayer 6y agoYes. I’m not sure about speed, but syntactically they are far superior and better for all cases, unless of course you’re wanting to pass templates as an input, but that’s pretty obvious.