[Python-ideas] Briefer string format

Oleg Broytman phd at phdru.name
Mon Jul 20 08:30:12 CEST 2015


Hi!

On Sun, Jul 19, 2015 at 07:50:52PM -0400, Terry Reedy <tjreedy at udel.edu> wrote:
> On 7/19/2015 7:12 PM, Mike Miller wrote:
> >Have long wished python could format strings easily like bash or perl
> >do, ...
> >and then it hit me:
> >
> >     csstext += f'{nl}{selector}{space}{{{nl}'
> 
> Are the unbalanced braces here and in the followup intentional?

   I'm sure they are. The code is supposed to generate something
equivalent to

csstext += '''
p.italic {
'''

   to be extended later with something like

csstext += '''
   font-style: italic;
}
'''

> -- 
> Terry Jan Reedy

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-ideas mailing list