[Python-ideas] Briefer string format

Paul Sokolovsky pmiscml at gmail.com
Mon Jul 20 01:59:19 CEST 2015


Hello,

On Sun, 19 Jul 2015 16:35:01 -0700
Mike Miller <python-ideas at mgmiller.net> wrote:

[]

>      csstext += f'{nl}{key}{space}{{{nl}'
> 
> An "f-formatted" string could automatically format with the locals
> dict. Not yet sure about globals, and unicode only suggested for
> now.

"Not sure" sounds convincing. Deal - let's keep being explicit rather
than implicit. Brevity?

def _(fmt, dict):
    return fmt.format(**dict)
__ = globals()
___ = locals()

foo = 42

_("{foo}", __())


If that's not terse enough, you can take Python3, and go thru Unicode
planes looking for funky-looking letters, then you hopefully can reduce
to

.("{foo}", .())

Where dots aren't dots, but funky-looking letters.


-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-ideas mailing list