
[Mark Hammond]
... MSVC exposes a global variable that contains the default [fopen] mode - ie, you can change the default to binary. (_fmode for those with the docs)
This has some implications and questions: * Will Guido ever bow to pressure (when it arrives :) to expose this via the "msvcrt" module?
No. It changes the advertised semantics of Python builtins, and no option ever does that. If it went in at all, it would have to be exposed as a Python-level feature that changed the semantics similarly on all platforms -- and even then Guido wouldn't put it in <wink>.
... Thus, it appears that to be 100% sure what mode you are using, you should not rely on the default, but should _always_ use "b" or "t" on the file mode.
And on platforms that have libc options to treat "t" as if it were "b"? There's no limit to how perverse platform options can get! There's no fully safe ground to stand on, so Python stands on the minimal guarantees libc provides. If a user violates those, tough, they can't use Python. Unless, of course, they contribute a lot of money to the PSA <wink>.
... Any thoughts or comments? The case for abandoning the CRTL's text mode gets stronger and stronger!
C's text mode is, alas, a bad joke. The only thing worse is Microsoft's half-assed implementation of it <0.5 wink>. ctrl-z-=-eof-even-gets-in-the-way-under-windows!-ly y'rs - tim