[Python-ideas] Briefer string format

Eric V. Smith eric at trueblade.com
Tue Jul 21 16:24:18 CEST 2015


On 7/21/2015 9:03 AM, Guido van Rossum wrote:
> Thanks, Eric! You're addressing all my concerns and you're going exactly
> where I wanted this to go. I hope that you will find the time to write
> up a PEP; take your time. Regarding your [1], let's not consider
> unevaluated f-strings as a feature; that use case is sufficiently
> covered by the existing str.format().

Thanks, Guido.

I'd already given some thought to a PEP. I'll work on it. I don't have a
ton of free time, but I'd like to at least get the ideas presented so
far written down.

One thing I haven't completely thought through is nested expressions:
f'{value:.{precision}f}'

I guess this would just become:
format(value, '.' + format(precision) + 'f')

If I recall correctly, we only support recursive fields in the format
specifier portion, and only one level deep. I'll need to keep that in mind.

If this gets accepted, I'll have to speed up my own efforts to port my
code to 3.x.

Eric.


More information about the Python-ideas mailing list