[Python-ideas] Briefer string format

Eric V. Smith eric at trueblade.com
Mon Jul 20 15:42:46 CEST 2015


On 07/19/2015 07:35 PM, Mike Miller wrote:

> Decent but not great, a bit hard on the eyes.  So I decided to try
> .format():
> 
>     csstext += '{nl}{key}{space}{{{nl}'.format(**locals())
> 
> This looks a bit better if you ignore the right half, but it is longer
> and not
> as simple as one might hope.

Better would be:
    csstext += '{nl}{key}{space}{{{nl}'.format_map(locals())

Eric.



More information about the Python-ideas mailing list