[Python-3000] New io system and binary data (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 20 05:38:06 CEST 2007
- Previous message: [Python-3000] New io system and binary data
- Next message: [Python-3000] Implementing Abstract Interface for Numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
skip at pobox.com wrote:
Binary has (like it or not) been the default behavior on all previous Pythons running on Unix systems where text and binary were never different
Um, no, text has always been the default on all systems. It's just that on systems where text and binary are the same, you don't notice the difference. This has led some Unix programmers into bad habits.
The only time I ever open a file with the "b" attribute is when I expect that code to run on Windows
A more defensive approach is to always open with "b" when you're dealing with binary data, then it will work even if someone does happen to run it on Windows.
Programs following this philosophy won't have any problems with Py3k (at least not from that source).
-- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-3000] New io system and binary data
- Next message: [Python-3000] Implementing Abstract Interface for Numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]