[Python-Dev] PEP-498: Literal String Formatting
Alexander Walters
tritium-list at sdamon.com
Sat Aug 8 16:05:02 CEST 2015
More information about the Python-Dev mailing list
Sat Aug 8 16:05:02 CEST 2015
- Previous message (by thread): [Python-Dev] PEP-498: Literal String Formatting
- Next message (by thread): [Python-Dev] PEP-498: Literal String Formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Please do not change the meaning of the vestigial U''. It was re-added to the language to fix a problem, rebinding it to another meaning introduces new problems. We have plenty of other letters in the alphabet to use. On 8/8/2015 05:34, Nick Coghlan wrote: > On 8 August 2015 at 11:39, Eric V. Smith <eric at trueblade.com> wrote: >> Following a long discussion on python-ideas, I've posted my draft of >> PEP-498. It describes the "f-string" approach that was the subject of >> the "Briefer string format" thread. I'm open to a better title than >> "Literal String Formatting". > Thanks you for your work on this - it's a very cool concept! > > I've also now written and posted an initial draft of PEP 500, based > directly on PEP 498, which formalises the "__interpolate__" builtin > idea I raised in those threads, along with a PEP 292 based syntax > proposal that aims to be as simple as possible for the simple case of > interpolating existing variables, while still allowing the use of > braces to permit embedding of arbitrary expressions and formatting > directives. > > it turned out this approach provided an unanticipated benefit that I > only discovered while writing the PEP: by defining a separate > "__interpolateb__" builtin, it's straightforward to define binary > interpolation in terms of bytes.__mod__, while still defining text > interpolation in terms of str.format. > > The previously-redundant-in-python-3 'u' prefix also finds new life as > a way of always requesting the default string interpolation, even if > __interpolate__ has been overridden in the current namespace to mean > something else (like il8n string translation). > > Cheers, > Nick. >
- Previous message (by thread): [Python-Dev] PEP-498: Literal String Formatting
- Next message (by thread): [Python-Dev] PEP-498: Literal String Formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list