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

2014年2月23日 18:32:22 -0800

Glenn Linderman writes:
 > On 2/23/2014 2:25 PM, Antoine Pitrou wrote:
 >> On 2014年2月23日 14:14:55 -0800 Glenn Linderman <[email protected]> 
 >> wrote:
 >>> On 2/23/2014 1:37 PM, Antoine Pitrou wrote:
 >>>> And you certainly*don't* print debugging output into a wire protocol.
 >>> Web server applications do, so they can be displayed in the browser.
 >> They may embed debugging information into some HTML code, which
 >> then will be sent over the wire. However, usually they don't
 >> print debugging output directly into HTTP.
 > The HTML is sent over the wire via HTTP... that's pretty directly
 > in the wire protocol...
Not in the relevant sense. In a modern web framework, the HTML will
typically be in internal text encoding because the framework can't
know what the programmer/web developer/user will be using. So there's
no need at all for PEP 461 here: you're going to be using str, and
then running it through .encode() anyway.
 > the HTTP headers are immediately followed by the HTML, and when the
 > document is being generated on the fly, it may also be being
 > encoded on the fly. I've seen it done, although I can't confirm or
 > deny the "usually" claim you have made.
I'm sure you've seen it done. Is it worth providing special support
for it? I don't think so, and Nick's "we don't want people writing
__bytes__ methods" argument sounds suspiciously like a child-proof cap
to me. If people really wanna do that, let them use ascii().
_______________________________________________
Python-Dev mailing list
[email protected]
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