[Python-Dev] PEP 461 - Adding % and {} formatting to bytes

Eric Snow ericsnowcurrently at gmail.com
Fri Jan 17 09:07:48 CET 2014


On Thu, Jan 16, 2014 at 3:06 PM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
> I'd treat the format()+.__format__()+str.format()-"ecosystem" as
> a nice text-data-oriented, *complete* Py3k feature, backported to
> Python 2 to share the benefits of the feature with it as well as
> to make the 2-to-3 transition a bit easier.
>
> IMHO, the PEP-3101's note cited above just describes a workaround
> over the flaws of the Py2's obsolete text model.  Moving such
> complications into Py3k would make the feature (and especially the
> ability to implement your own .__format__()) harder to understand
> and make use of -- for little profit.
>
> Such a move is not needed for compatibility.  And, IMHO, the
> format()/__format__()/str.format()-matter is all about nice and
> flexible *text* formatting, not about binary data interpolation.

[disclaimer: I personally don't have many use cases for any bytes formatting.]

Yet there is still a strong symmetry between str and bytes that makes
bytes easier to use.  I don't always use formatting, but when I do I
use .format(). :)

never-been-a-fan-of-mod-formatting-ly yours,

-eric


More information about the Python-Dev mailing list