[Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 3

Ethan Furman ethan at stoneleaf.us
Thu Mar 27 20:11:03 CET 2014


On 03/27/2014 11:59 AM, Guido van Rossum wrote:
>
> PS. I am not trying to be difficult. I honestly don't understand the use case yet, and the PEP doesn't do much to
> support it.

How's this?
----------------------------------------------------------------------------
Compatibility with Python 2
===========================

As noted above, ``%s`` is being included solely to help ease migration from,
and/or have a single code base with, Python 2.  This is important as there
are modules both in the wild and behind closed doors that currently use the
Python 2 ``str`` type as a ``bytes`` container, and hence are using ``%s``
as a bytes interpolator.

However, ``%b`` should be used in new, Python 3 only code, so ``%s`` will
immediately be deprecated, but not removed until the next major Python
release.
----------------------------------------------------------------------------

--
~Ethan~


More information about the Python-Dev mailing list