Python 3 is killing Python

Terry Reedy tjreedy at
Wed Jul 16 23:02:42 CEST 2014

On 7/16/2014 3:49 AM, Steven D'Aprano wrote:

> There are certainly use-cases for stdin and stdout to use bytes, but
> there are also use-cases for them to deal with strings. I'll certainly
> grant you that there ought to be an easy way to get access to the binary
> streams,

As has been discussed before on this list, there is in 3.x.

 >>> b=sys.stdin.buffer.readline()
a line
 >>> b
b'a line\r\n'

In other words, 3.x text mode (which essentially nothing to do with 2.x 
'text' mode), is a wrapped binary mode that gives users the *choice* to 
read bytes or text.

Terry Jan Reedy

More information about the Python-list mailing list