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

Guido van Rossum guido at python.org
Mon Jan 13 23:14:55 CET 2014


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.

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list