3 ms·
I too have become fond of str.format. OTOH, I'm sure there are people complaining about it. And the fact is that their complaints have merit, no matter how awes
by ggchappell 12y ago
I too have become fond of str.format. OTOH, I'm sure there are people complaining about it. And the fact is that their complaints have merit, no matter how awesome str.format may be.
printf and shell-style variable interpolation have been with us for a long time, and they're not going away any time soon. Learning how to use them is time well spent. If someone copies either of these interfaces, then immediately lots of people know how to use the result.
But str.format is only for Python. I doubt anyone is going to clone it in some other language (prove me wrong!). Now, I use Python often enough that I don't forget how str.format works between times I need to use it. But for many people, it's just annoying.
In any case, a nice article. I learned a couple of new tricks to try.
- reuven 12y agoYeah, the fact that str.format is unique to Python, and isn't Python, is a problem. It doesn't matter how thoughtfully designed that mini-language is. Fortunately, the basics are simple enough that you can get your head around it rather quickly (as I've learned).