Terry Reedy <tjre...@udel.edu>: > On 6/5/2014 5:53 AM, Marko Rauhamaa wrote: >> Chris Angelico <ros...@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 -- https://mail.python.org/mailman/listinfo/python-list