[Web-SIG] Declaring PEP 3333 accepted (was: PEP 444 != WSGI 2.0)

P.J. Eby pje at telecommunity.com
Tue Jan 4 16:48:25 CET 2011


At 06:30 PM 1/3/2011 -0800, Guido van Rossum wrote:
>Would
>
>   sys.stdout.buffer.write(b'abc')
>
>do?
>
>(If you mix this with writing strings to sys.stdout directly, you may
>have to call sys.stdout.flush() first.)

The current code is:

             sys.stdout.write(data)  # TODO: this needs to be binary on Py3
             sys.stdout.flush()

Should I be using sys.stdout.buffer for both, or just the write?

For the CGI example in the PEP, I don't want to bother trying to make 
it fully production-usable; that's what we have wsgiref in the stdlib 
for.  So I won't worry about mixing strings and regular output in the 
example, even if perhaps wsgiref should add the StringIO's proposed by Graham.



More information about the Web-SIG mailing list