On Thu, 18 Nov 1999, M.-A. Lemburg wrote: > Tim Peters wrote: > > [MAL] > > > File objects opened in text mode will use "t#" and binary > > > ones use "s#". > > > > [Greg Stein] > > > ... > > > The real annoying thing would be to assume that opening a file as 'r' > > > means that I *meant* text mode and to start using "t#". > > > > Isn't that exactly what MAL said would happen? Note that a "t" flag for > > "text mode" is an MS extension -- C doesn't define "t", and Python doesn't > > either; a lone "r" has always meant text mode. > > Em, I think you've got something wrong here: "t#" refers to the > parsing marker used for writing data to files opened in text mode. Nope. We've got it right :-) Tim and I used 'r' and "t" to refer to file-open modes. I used "t#" to refer to the parse marker. >... > I guess you won't notice any difference: strings define both > interfaces ("s#" and "t#") to mean the same thing. Only other > buffer compatible types may now fail to write to text files > -- which is not so bad, because it forces the programmer to > rethink what he really intended when opening the file in text > mode. It *is* bad if it breaks my existing programs in subtle ways that are a bitch to track down. > Besides, if you are writing portable scripts you should pay > close attention to "r" vs. "rb" anyway. I'm not writing portable scripts. I mentioned that once before. I don't want a difference between 'r' and 'rb' on my Linux box. It was never there before, I'm lazy, and I don't want to see it added :-). Honestly, I don't know offhand of any Python types that repond to "s#" and "t#" in different ways, such that changing file.write would end up writing something different (and thereby breaking existing code). I just don't like introduce text/binary to *nix platforms where it didn't exist before. Cheers, -g -- Greg Stein, http://www.lyra.org/
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