[Python-ideas] Briefer string format

Guido van Rossum guido at python.org
Tue Jul 21 15:50:51 CEST 2015


On Tue, Jul 21, 2015 at 3:05 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> I wonder though, if we went with the f-strings idea, could we make
> them support a *subset* of the "str.format" call syntax, rather than a
> superset? What if they supported name and attribute lookup syntax, but
> not positional or subscript lookup?
>

I don't know. Either way there's going to be complaints about the
inconsistencies. :-( I wish we hadn't done the {a[x]} part of PEP 3101, but
it's too late now. :-(


> They'd still be a great for formatting output in scripts and debugging
> messages, but more complex formatting cases would still involve
> reaching for str.format,  str.format_map or exec("print(f'{this} is an
> odd way to do a {format_map} call')", namespace).
>

You lost me there (probably by trying to be too terse).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150721/a2e385a8/attachment.html>


More information about the Python-ideas mailing list