[Pythonmac-SIG] Re: [Python-Dev] Import hook to do end-of-line conversion?

Guido van Rossum guido@digicool.com
Mon, 09 Apr 2001 21:32:51 -0500


> Chris Barker <chrishbarker@home.net>:
> 
> > Even if people have been sloppy and used binary mode for text files
> > under *nix, that code would still work with *nix text files, which is
> > the only way it works now anyway.
> 
> That's a good point. The only thing that could break is if
> you opened a non-Unix file in *text* mode, and then expected
> it to behave as though it had been opened in *binary* mode.
> I can't imagine any code being screwy enough to do that!

Actually, that *is* the scenario I'm worried about.  Someone can open
a GIF file in text mode today on a Unix platform and it'll just work
(until they port the program to another platform, that is. ;-).  So
Unix weenies haven't had much of an incentive (or warning) about using
binary mode properlu.

In text translation mode, if there happen to be bytes with values 0x0d
in the file, they will be mangled.

--Guido van Rossum (home page: http://www.python.org/~guido/)