On 1/13/2014 5:14 PM, Guido van Rossum wrote:
On Mon, Jan 13, 2014 at 2:05 PM, Brett Cannon <br...@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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com