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

Chris Angelico rosuav at gmail.com
Tue Sep 8 01:15:05 CEST 2015


On Tue, Sep 8, 2015 at 7:00 AM, Andrew Barnert via Python-ideas
<python-ideas at python.org> wrote:
> But there will always be cases that % is better for, such as:
>
>  * sharing a table of format strings with code in C or another language
>  * simple formats that need to be done fast in a loop
>  * formatting strings to use as str.format format strings
>  * messages that you've converted from logging to real output
>  * ASCII-based wire protocols or file formats

Supporting this last one is PEP 461. There are no proposals on the
cards to add a b"...".format() method (it's not out of the question,
but there are problems to be overcome because of the extreme
generality of it), yet we have percent formatting for bytestrings. I
think that's a strong indication that percent formatting is fully
supported and will be for the future.

ChrisA


More information about the Python-ideas mailing list