[Python-Dev] PEP 460 reboot (original) (raw)

Terry Reedy tjreedy at udel.edu
Tue Jan 14 03:30:14 CET 2014


On 1/13/2014 5:14 PM, Guido van Rossum wrote:

On Mon, Jan 13, 2014 at 2:05 PM, Brett Cannon <brett at python.org> wrote:

I have been going on the assumption that bytes.format() would change what '{}' meant for itself and would only interpolate bytes. That convenient between Python 2 and 3 since it represents what we want it to (str and bytes under the hood, respectively), so it just falls through. We could also add a 'b' conversion for bytes() explicitly so as to help people not accidentally mix up things in bytes.format() and str.format(). But I was not suggesting adding a specific format spec for bytes but instead making bytes.format() just do the .encode('ascii') automatically to help with compatibility when a format spec was present. If people want fancy formatting for bytes they can always do it themselves before calling bytes.format(). This seems hastily written (e.g. verb missing :-), and I'm not clear on what you are (or were) actually proposing. When exactly would bytes.format() need .encode('ascii')? I would be happy to wait a few hours or days for you to to write it up clearly, rather than responding in a hurry.

I already posted my version of this proposal, with spec and example, in the thread "byteformat() proposal: please critique", and I added more in response to your earlier post.

-- Terry Jan Reedy



More information about the Python-Dev mailing list