Re:PyFormat – Practical examples of old and new style string...
by x1798DE on Thursday April 16, 2015 @08:35AM
(#9387473)
I think the point would be to do something like:
Then you don't have to figure out specifying order or definitions like ".format(a=a, b=b, c=c)". I'd probably go the more explicit route in production code anyway, but for debugging / unstable development it seems useful.
[ Parent
| on HN ]
Re:PyFormat – Practical examples of old and new style string...
by wodenokoto on Friday April 17, 2015 @04:10AM
(#9392833)
I'm still not convinced. In order to write the string portion of the code, I need to know the names of the variables in play and I have to order them in them in some order in the string regardless.
So I still don't think
"A is {a}, C is {c}, B is {b}".format(**locals())
is better than "A is {}, C is {}, B is {}".format(a, c, b)