Python 3.2 has some deadly infection

Marko Rauhamaa marko at pacujo.net
Thu Jun 5 16:21:35 EDT 2014


Terry Reedy <tjreedy at udel.edu>:

> On 6/5/2014 5:53 AM, Marko Rauhamaa wrote:
>> Chris Angelico <rosuav at gmail.com>:
>>
>>> If the standard streams are so crucial, why are their most obvious
>>> interfaces insignificant to you?
>>
>> I want the standard streams to consume and produce bytes.
>
> Easy. Read the manual entry for stdxxx. "To write or read binary data
> from/to the standard streams, use the underlying binary buffer object.
> For example, to write bytes to stdout, use
> sys.stdout.buffer.write(b'abc')"

This note from the manual is a bit vague:

   Note that the streams can be replaced with objects (like io.StringIO)
   that do not support the buffer attribute or the detach() method

"Can be replaced" by who? By the Python developers? By me? By random
library calls?

Does it mean the buffer and detach are not guaranteed to stay with the
API?


Marko



More information about the Python-list mailing list