[Python-3000] New io system and binary data (original) (raw)
Terry Reedy tjreedy at udel.edu
Thu Sep 20 03:24:04 CEST 2007
- Previous message: [Python-3000] New io system and binary data
- Next message: [Python-3000] New io system and binary data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Guido van Rossum" <guido at python.org> wrote in message news:ca471dc20709191019k2f5e16e5j75767b25ddf90e30 at mail.gmail.com... | Changing the mode between text and binary is not feasible (since it | would have to change the class). But it is perfectly acceptable to use | sys.std{in,out}.buffer if you need to write a binary transparent | filter.
In PEP 3116, the Buffered I/O section has Additionally, the abstract base class provides one member variable: .raw A reference to the underlying RawIOBase object.
The Text I/O section does not have, but I presume should, similar lines about member variable .buffer.
Perhaps a note could be added that stdin/out will be Text I/O and that the bytes buffer is easily unwrapped via .buffer (and even via .raw).
While I sympathize with the initial surprise, I am willing to type .buffer should I need to. The real problem is that 2to3.py cannot do so automatically (and be always. and probably not even usually, correct).
tjr
- Previous message: [Python-3000] New io system and binary data
- Next message: [Python-3000] New io system and binary data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]