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. Until now, all files used the "s#" parsing marker for writing data, regardeless of being opened in text or binary mode. The new interpretation (new, because there previously was none ;-) of the buffer interface forces this to be changed to regain conformance. > > In actuality, I typically open files that way since I do most of my > > coding on Linux. If I now have to pay attention to things and open it > > as 'rb', then I'll be pissed. > > > > And the change in behavior and bugs that interpreting 'r' as text would > > introduce? Ack! > > 'r' is already intepreted as text mode, but so far, on Unix-like systems, > there's been no difference between text and binary modes. Introducing a > distinction will certainly cause problems. I don't know what the > compensating advantages are thought to be. 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. Besides, if you are writing portable scripts you should pay close attention to "r" vs. "rb" anyway. [Strange, I find myself argueing for a feature that I don't like myself ;-)] -- Marc-Andre Lemburg ______________________________________________________________________ Y2000: 43 days left Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
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