On 6/28/2011 10:02 AM, M.-A. Lemburg wrote: > How about a more radical change: have open() in Py3 default to > opening the file in binary mode, if no encoding is given (even > if the mode doesn't include 'b') ? > > That'll make it compatible to the Py2 world again I disagree. I believe S = open('myfile.txt').read() now return a text string in both Py2 and Py3 and a subsequent 'abc' in S works in both. > and avoid all the encoding guessing. > Making such default encodings depend on the locale has already > failed to work when we first introduced a default encoding in > Py2, so I don't understand why we are repeating the same > mistake again in Py3 (only in a different area). I do not remember any proposed change during the Py3 design discussions. > Note that in Py2, Unix applications often leave out the 'b' > mode, since there's no difference between using it or not. I believe it makes a difference now as to whether one gets str or bytes. > Only on Windows, you'll see a difference. I believe the only difference now on Windows is the decoding used, not the return type. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4