Issue 6301: Error in tutorial section 7.2 (original) (raw)

Created on 2009-06-18 01:14 by melbourne, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (10)
msg89487 - (view) Author: david (melbourne) Date: 2009-06-18 01:14
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing- files "Windows makes a distinction between text and binary files; "the end-of-line characters in text files are automatically altered "slightly when data is read or written. Windows does not make a distinction between text and binary files: http://msdn.microsoft.com/en-us/library/aa365430(VS.85).aspx http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx http://msdn.microsoft.com/en-us/library/aa365467(VS.85).aspx Nor does it automatically alter end-of-line characters. It is not clear what distinction Python makes between text and binary files. Do those options do anything on any platform? Is jPython different than cPython? And does Python automatically alter end-of-line characters?
msg89491 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-06-18 06:57
Even if the Win32 API functions do not have a concept of text/binary files, the C library functions that MS provides, and Python uses, have. See http://msdn.microsoft.com/en-us/library/yeby3zcb(VS.71).aspx
msg89496 - (view) Author: david (melbourne) Date: 2009-06-18 08:18
So, it's wrong, and it's not helpful unless you already know what it means, but it works for someone who doesn't need the Python tutorial! I'm gobsmacked. If "the C libraries that Python uses" have the concept of Text/Binary, why not just say so? Conversely, if you are ashamed to admit that use of Python requires knowledge of C, why not just change the tutorial to TALK ABOUT PYTHON? I never wanted to back anyone into a corner: I'm just amazed at all this. It's wrong, fix it, why defend it?
msg89497 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-06-18 09:03
A small improvement could be made: - Windows makes a distinction between text and binary files + Python on Windows makes a distinction between text and binary files The meaning should have been obvious as-is, but the fact of the matter is that the OP is "gobsmacked" and "amazed" so surely something must be done ;-)
msg89510 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-06-18 22:04
I'm -0 about that change. However, I'd like to defend the original wording; it is *not* Python that makes the text/binary distinction. Python just calls fopen(), which is what portable C programs are supposed to do, with the mode it is given by the programmer in open(). Python neither ships nor owns the C library. For the Python programmer however, it is irrelevant which part of the system that Python uses has a particular behavior, he just notes that *on that system* it can be observed. How about "On Windows, a distinction is made ..."?
msg89511 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-06-18 22:19
The wording as it stands just seems plain wrong. Either "Python on Windows" or "On Windows" is better - the former over the latter but either...
msg89515 - (view) Author: david (melbourne) Date: 2009-06-19 00:12
If this is like to be non-portable to jPython, I'd like to be told. However, I can see that the tutorial may be the wrong place to mention that.
msg89516 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-06-19 00:13
This behavior of Python when reading files is so fundamental that I can't imagine Jython doesn't behave the same way. (IronPython certainly has the same behavior.)
msg89518 - (view) Author: Philip Jenvey (pjenvey) * (Python committer) Date: 2009-06-19 00:57
Jython 2.5 behaves in the same way
msg92570 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-09-13 16:14
Committed revision 74779.
History
Date User Action Args
2022-04-11 14:56:50 admin set github: 50550
2009-09-13 16:14:12 michael.foord set messages: +
2009-06-19 00:57:01 pjenvey set nosy: + pjenveymessages: +
2009-06-19 00:13:37 michael.foord set messages: +
2009-06-19 00:12:22 melbourne set messages: +
2009-06-18 22:19:42 michael.foord set nosy: + michael.foordmessages: +
2009-06-18 22:04:29 georg.brandl set messages: +
2009-06-18 09:03:29 rhettinger set priority: lownosy: + rhettingermessages: +
2009-06-18 08🔞49 melbourne set messages: +
2009-06-18 06:57:57 georg.brandl set status: open -> closedresolution: works for memessages: +
2009-06-18 01:43:04 cvrebert set nosy: + cvrebert
2009-06-18 01:14:20 melbourne create