[Python-Dev] Simplify the file-like-object interface
Paul Moore
p.f.moore at gmail.com
Tue Sep 13 17:14:35 CEST 2005
More information about the Python-Dev mailing list
Tue Sep 13 17:14:35 CEST 2005
- Previous message: [Python-Dev] Simplify the file-like-object interface
- Next message: [Python-Dev] Simplify the file-like-object interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 9/13/05, Michael Chermside <mcherm at mcherm.com> wrote: > In unix, the above is true. One of the fundamental decisions in Unix > was to treat all files (and lots of other vaguely file-like things) > as undiferentiated streams of bytes. But this is NOT true on many > other operating systems. It is not, for example, true on Windows. <nitpick> Actually, on Windows, it *is* true. At the OS API level, all files are streams of bytes (it's not as uniform as Unix - many things that Unix forces into a file-like mould don't look exactly like OS-level files on Windows, consoles and sockets being particular examples). However, at the C library level, text files are "special" insofar as the C stdio routines handle CRLF issues and the like differently. The problem is twofold: (1) that Python works with the C runtime, so stdio behaviour gets involved, and (2) on Windows, the familiar Unix/C conventions of "\n" for "newline" don't work without translation - so if you write text to a binary file, your output doesn't conform to the *conventions* used by other applications (notably notepad - it's surprising how many Windows programs actually work fine with LF-delimited lines in text files...) </nitpick> Paul.
- Previous message: [Python-Dev] Simplify the file-like-object interface
- Next message: [Python-Dev] Simplify the file-like-object interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list