Learning Python, Third Edition by Mark Lutz The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated August 1, 2008. UNCONFIRMED errors and comments from readers: (all) end of each section; Almost EVERY section ends with a sentence including the phrase "...later in this book." Forward references abound - showing that the book is either 1) designed backwards, or 2) introducing extraneous or advanced topics far in advance of their proper placement. For instance, there's no reason to introduce embedding on page 56. If someone wants to know if the language supports it, they can look at the table of contents. ALSO, on P62 author introduces new material in the end-of-chapter exercises! A no-no! ALSO, on P57 you get this sentence: "As mentioned previously, (sic) although not full-blown IDE GUIs, most programmer friendly text editors have support for editing, and possibly running, Python programs." (24)Second code example; The letters "km" after the number should be removed. (49) Last heading; the first word of the title, "import", is in lower case. [79]3rd line from the bottom; D['quantity'] += 1 should be D['quantity'] + 1 {101}page 101; >>> "%e" % num '3.333333e-001' ...should be... >>> "%e" % num '3.333333e-01' There is an extra zero in the exponent in the book. (107)5th paragraph; The paragraph reads "Printing the result to produce the user-friendly display format doesn't completely help, either because the hardware related to floating-point math is inherently limited in terms of accuracy:" I believe the comma is misplaced, and should be at "...doesn't completely help either, because the hardware..." {109} first paragraph in "Booleans" section and footnote; First paragraph in "Booleans" section is almost completely redundant with starred footnote. (113) Bottom; The word "repetition" has been misspelled as "repitition". {161} Table 8-2; (3rd edition) The table shows dict.fromvalues(['a', 'b']) as an alternative dictionary construction technique, but there is no such method as "fromvalues" for the dictionary object. Page 170 shows dict.fromkeys(['a', 'b'], 0), which is valid and probably what belongs in the table. {171} Quiz Answers 2.; 1) In the text: or a series of assignments like D = [], D['a'] = 0, D['b'] = 0 "D = []" should be "D = {}" 2) The last sentence of this paragraph, "because all the keys are the same", should be "because all the values are the same". {177} Table 9-2; In the Operation column; the second last row says outout.flush(). It won't work it needs to be output.flush() {190} Figure 9-3; The type "Set" is listed as a number type in figure 9-3, while the correct is that it is a collection type. At least that is what it says on page 108 (in the same book). {220} example at bottom of page; First line should read def knights(name) Fourth line should read return action(name) {222} 5; The book states that: [T]he expression ((a and b) or c) is roughly equivalent to: if a: b else: c However, plugging in values a=1, b=0, and c=1 will give different answers for the two logical statements: ((1 and 0) or 1) evaluates to 1, while if 1: 0 else: 1 evaluates to 0. (233) 4th paragraph; In the paragraph that starts "This works because..." there is a typo in the name of the stream: "sys.sytdout" should be "sys.stdout". {259}In the Why You Will Care: File Scanners box; In the Why You Will Care: File Scanners box, second to last code example, xreadlines() is presented as an option. According to the Python Library Reference, xreadlines() is "...Deprecated since release 2.3. Use "for line in file" instead." http://docs.python.org/lib/bltin-file-objects.html {283}1st paragraph; The user typed command ">>> print open.__doc__" does not match with the printed output "file(name[, mode[, bhuffering]]) -> file object". The correct user typed command has to be instead ">>> print file.__doc__" {322} last line of first code listing; In the first code listing on this page, the 4th line is indented incorrectly. The "return action" line should be moved 4 spaces to the right, to be indented the same as the line "def action(X):". That is, the "action" function is returned by the "maker" function. As is, the code's indentation generates a syntax error. (329) 1st paragraph; 3rd line is "our programs with"... should be "our programs without"... [355] bottom output lines; bottom output sequence is not what i got from python version 2.5.1 on a Solaris ultra 45 using OS 5.10 i got data1 then data3 than data2 it should be (i think) 3,2,1 as shown in book this implies that the order in which classes are accessed is not from bottom all the way up starting from left to right ie, python implementation is wrong (462) Beginning of 2nd paragraph; The word awhile exists, but it is an adverb. So, "a while" should be used instead. [463] quiz 2.; "top to bottom" should be "bottom to top" (471) 2nd paragraph; from "For instance..." to "For example..." instance is an object created... [525]streams.py code example; In order for interactive example at top of page 526 to work, the line "self.writer.close()" should be inserted after "self.writer.write(data)" but indented the same as "while 1:". Unlike sys.stdout, a data file must be closed for data to be finally saved to it (that is, so it can be recalled later as in "type spamup.txt" on page 526). After submitting this error, I tried to be sure everything still worked. The converters.py still worked running standalone. The example at the top of page 526 worked this time, with actual output to "type spamup.txt" (actually my command was "cat spamup.txt" in Linux). However the second interactive example on page 526 didn't work this time. After the output "
SPAM
", etc., the was an error: AttributeError: HTMLize instance has no attribute 'close'. So whether .py files or interactive examples will have to be modified to achieve total lack of errors, I will try to see if I can suggest anything in keeping with the simplicity of your examples. In order for the second interactive example in page 526 to work, after including my suggested addition to streams.py, try adding an interactive entry below "print '
%s
' % line[:-1]" in class HTMLize. Indented the same as the first "def" try: "def close(self): pass". As crude as this is, it will include "close" in the namespace of class HTMLize, and thus eliminate the error, hopefully without introducing any new ones. (540) last line of class code; (3rd Edition) This isn't an error at all: return 'Set:' + `self.data` But backticks aren't covered at all previous to this page (I don't think so, anyway). It was a good opportunity to go on the web to learn that it is the same as: repr(self.data) I suspect this is left over from previous editions of the book and that repr(self.data) would be the more modern technique intended. (Which is exactly what is mentioned in the preface to "Programming Python": that `backticks` have been replaced with repr(). {674} Line before answer to question 4; The last line in the code sample has a typo. Instead of print 'Got', sys.exc_info(){0], .... it should say print 'Got', sys.exc_info()[0], ....