3 ms·
He and I'd never write out the full dictionary and would use a single arg or tuple. Why? dunno... probably habit, sample code never showed it, mostly because
by mixmastamyk 12y ago
He and I'd never write out the full dictionary and would use a single arg or tuple.
Why? dunno... probably habit, sample code never showed it, mostly because it would be ridiculous. Why is it not ridiculous with {}? It is, though he would never agree.
I usually don't care about performance either, but the third example is easier to read and type. Looks just like a printf.
- dalke 12y agoGoing back a few posts: > There was a guy at work who insisted on using .format() for everything that soured me on it, sometimes even simple string concatenation It sounds like you are soured on new-style .format() because someone else doesn't use it appropriately. You concluded that it's intrinsic to .format(), even though s%{} is even more verbose, because of what seems to be an idiosyncratic preferences of one person. I empathize with your other arguments. I too am much more familiar with printf-style % arguments than the Python-specific .format() syntax, which still cause me to reach for the documentation. But I do not think that it's reasonable to complain about its verbosity.
- mixmastamyk 12y agoIt is, Guido said it himself. Looks like I added an extra pair of curly brackets into the example that I first mentioned. That was a typo, sorry about that, it shouldn't have existed, and unfortunately probably why you insist that someone should do this 's%'%{...} though no one ever has to my knowledge.