[Python-3000] Does Py3k's print offer any unicode encoding help?

Guido van Rossum guido at python.org
Sat Feb 16 01:36:34 CET 2008


On Fri, Feb 15, 2008 at 4:21 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Adam Olsen wrote:
>  > That'd rely on prompt deletion for correct behaviour.  Why not an
>  > explicit detach method?
>  >
>  > buf = sys.stdout.buffer
>  > sys.stdout.detach()
>  > sys.stdout = io.TextIOWrapper(buf, "utf-8")
>
>  Or keep an explicit count of the number of unclosed
>  wrappers that are referencing a buffer.

Yuck. We have to do this for sockets and it's a mess.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list