short form for string.format(…,**locals())
问题 I usually use the following pattern (as mentioned in this question): a=1 s= "{a}".format(**locals()) I think it's a great way to write easily readable code. Sometimes it's useful to "chain" string formats, in order to "modularize" the creation of complex strings: a="1" b="2" c="{a}+{b}".format(**locals()) d="{c} is a sum".format(**locals()) #d=="1+2 is a sum" Pretty soon, the code is pestered with X.format(**locals()) . To solve this problem, I tried to create a lambda: f= lambda x: x.format(