On 15 May 2018 at 16:23, Eric V. Smith <e...@trueblade.com> wrote: > I'm busy at the sprints, so I don't have a lot of time to think about this. > > However, let me just say that recursive format specs are supported, to a > depth of 1. > > >>> width=10 > >>> f'{"test":{width}}' > 'test ' > > So first the string is basically expanded to: > f'{"test":10}' > Then the string is formatted again to produce the final result. > > That is why the braces must match: they're being used for recursive format > specs. There's no mechanism for having braces that aren't inspected by the > f-string machinery.
https://www.python.org/dev/peps/pep-0536/ also seems worth noting (I don't actually understand the specifics of that PEP myself, just making sure that Ken's aware of its existence if this is an area of interest) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/