[Python-ideas] One way to do format and print

Nick Coghlan ncoghlan at gmail.com
Fri Sep 11 04:38:19 CEST 2015

On 11 September 2015 at 03:35, Sven R. Kunze <srkunze at mail.de> wrote:
> On 10.09.2015 17:36, Nick Coghlan wrote:
> This perspective doesn't grant enough credit to the significance of C
> in general, and the C ABI in particular, in the overall computing
> landscape. While a lot of folks have put a lot of work into making it
> possible to write software without needing to learn the details of
> what's happening at the machine level, it's still the case that the
> *one* language binding interface that *every* language runtime ends up
> including is being able to load and run C libraries.
> Ah, now I understand. We need to add {} to C. That'll make it, right? ;)
> Seriously, there are also other significant influences that fit better here:
> template engines. I know a couple of them using {} in some sense or another.
> C format strings are just one of them, so I wouldn't stress the significance
> of C that hard in that particular instance. There are other areas where C
> has its strengths.

You're tilting at windmills Sven. Python has 3 substitution variable
syntaxes (two with builtin support), and we no longer have any plans
for getting rid of any of them. We *did* aim to deprecate
percent-substitution as part of the Python 3 migration, and after
trying for ~5 years *decided that was a bad idea*, and reversed the
original decision to classify it as deprecated. We subsequently
switched the relevant section of the docs from describing
percent-formatting as "old string formatting" to "printf-style string
formatting" in a larger revamp of the builtin sequence type
documentation a few years back:

PEP 461 has now further entrenched the notion that "percent-formatting
is recommended for binary data, brace-formatting is recommended for
text data" by bringing back the former for bytes and bytearray in 3.5,
while leaving str.format as text only:

PEP 498 then blesses brace-formatting as the "one obvious way" for
text formatting by elevating it from "builtin method" to "syntax" in


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list