On 12 January 2014 09:23, Georg Brandl <g.bra...@gmx.net> wrote:
>> On 12 January 2014 01:01, Victor Stinner <victor.stin...@gmail.com> wrote:
>>> Supporting formating integers would allow to write b"Content-Length:
>>> %s\r\n" % 123, which would work on Python 2 and Python 3.
>>
>> I'm surprised that no-one is mentioning b"Content-Length: %s\r\n" %
>> str(123) which works on Python 2 and 3, is explicit, and needs no
>> special-casing of int in the format code.
>
> Certainly doesn't work on Python 3 right now, and never should :)

Sorry, I meant str(123).encode("ascii"), and I'd probably use a helper
function for it.

I could easily argue at this point that this is the type of bug that
having %-formatting operations on bytes would encourage - %s means
"format a string" (from years of C and Python (text) experience) so I
automatically supply a string argument when using %s in a bytes
formatting context.

The reality is that I was probably just being sloppy, though :-)
Paul
_______________________________________________
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

Reply via email to