python tutorial
Terry Reedy
tjreedy at udel.edu
Thu Jun 18 15:50:47 EDT 2009
>>>>
>>>> 1) Windows does not make a distinction between text and binary files.
'Windows', in its broad sense of Windoes system, includes the standards
and protocols mandated by its maker, Microsoft Corporation, and
implemented in its C compiler, which it uses to compile the software
that other interact with. I am pretty sure that WixXP Notepad *still*
requires \r\n in text files, even though Wordpad does not. Don't know
about Haste (la Vista) and the upcoming Win7.
It is a common metaphor in English to ascribe agency to products and
blame them for the sins (or virtues) of their maker.
'Unix' and 'Linux' are also used in the double meaning of OS core and OS
system that includes core, languages tools, and standard utilities.
>>>> 2) end-of-line characters in text files are not automatically
>>>> altered by
>>>> Windows.
>>>
>>> The Windows implementation of the C standard makes the distinction.
>>> E.g. using stdio to write out "foo\nbar\n" in a file opened in text
>>> mode will result in "foo\r\nbar\r\n" in the file. Reading such a file
>>> in text mode will result in "foo\nbar\n" in memory. Reading such a
>>> file in binary mode will result in "foo\r\nbar\r\n". In your bug
>>> report, you point out several proprietary APIs that do not make such
>>> a distinction, but that does not remove the implementations of the
>>> standard APIs that do make such a distinction.
>>>
>>> http://msdn.microsoft.com/en-us/library/yeby3zcb.aspx
>>>
>>> Perhaps it's a bit dodgy to blame "Windows" per se rather than its C
>>> runtime, but I think it's a reasonable statement on the whole.
I agree. There are much worse sins in the docs to be fixed.
Hmmm. "Bill Gates, his successors, and minions, still require, after 28
years, that we jump through artificial hoops, confuse ourselves, and
waste effort, by differentiating text and binary files and fiddling with
line endings."
More accurate, perhaps, but probably less wise than the current text.
Terry Jan Reedy
More information about the Python-list
mailing list