[Python-Dev] 'text' mode rears its ugly head again (original) (raw)

Bill Janssen janssen at parc.com
Mon Sep 17 20:08:27 CEST 2007


> differentiation between between text files and binary files, a bad > idea introduced by Windows and perpetuated (apparently) by Python. I > can't believe this wasn't eliminated in py3k!

The binary/text distinction is being increased in Py3k rather than reduced (the API for binary files uses bytes, the API for text files uses Unicode strings).

Actually, it's not so much the differentiation that bothers me, as it is the default of assuming "text". I think the default should be "binary", and getting the file in "text" mode should require extra effort. It should be 'rt', not 'rb' -- an extra qualifier for text mode, not for binary mode. That would eliminate a lot of the little bugs like this one that crop up in ports to the ineffable assemblage that is Windows.

Bill



More information about the Python-Dev mailing list