[Python-ideas] Briefer string format

Steve Dower Steve.Dower at microsoft.com
Mon Jul 20 23:46:45 CEST 2015


Bruce Leban wrote:
> [SNIP]
>
> Also, the discussion has assumed that if this feature were added it necessarily
> must be a single character prefix. Looking at the grammar, I don't see that as a
> requirement as it explicitly defines multiple character sequences. A syntax
> like:
> 
> format'a{b}c'
> formatted"""a{b}
> c"""
> 
> might be more readable. There's no namespace conflict just as there is no
> conflict between raw string literals and a variable named r.

I'd really like to be able to write fr"C:\{dir}\{filename}" at times (those rare times when I'm not using pathlib, admittedly), though there's no reason to need to combine f with u (a no-op) or b (no bytes.format).

Cheers,
Steve

> --- Bruce
> Check out my new puzzle book: http://J.mp/ingToConclusions
> Get it free here: http://J.mp/ingToConclusionsFree (available on iOS)
> 
>


More information about the Python-ideas mailing list