agezerlis (11) [Avatar] Offline
Dear Vern,

I am copying below a newer list of errata, focusing on chapters 8-14 (along with one correction from chapter 3, which I didn't notice the first time around). I have collected more errata for chapters 15-24, but I haven't found the time to type those up yet.

I have also posted a very positive review of "The Quick Python book" on I didn't mention the errata there, since I know that it is very common for a first printing of a technical volume to have many minor errors. Once again, congratulations on writing a great book!

Alex Gezerlis


p. 24 "clear, copy, get, has_key, items, keys, update, and values": as you discuss on p. 277, "has_key()" is not part of Python 3, and has been replaced by "key in dict".

p. 92 "variable is set to be the first element of sequence, and body is executed; then, variable is set to be the second element of sequence": you should change either the for loop to say "for variable in sequence" or the two instances in the discussion of "variable" to "item".

p. 93 "a sequence of integers from 0 up to 10000000": this should say "a sequence of integers from 0 up to 10000000-1".

p. 93 "the value of range(5,3) is an empty list": this should say "the value of list(range(5,3)) is an empty list".

p. 94 " as normal with the next item. .": one of the two periods should be removed.

p. 96 "A block containing a single line may be placed": this is not clear to me. Perhaps you want to say something like "A single-line block" or "A block of statements placed on a single line".

p. 100 "See the appendix for more details on precedence.": this should be "See the Python documentation for more details on precedence.".

p. 101 "let’s look a small sample that": this should say "let’s look at a small sample that".

p. 101 "format count, word_count, char_count))": this should be "format(line_count,word_count, char_count))".

p. 104, 105 The last prompt at the bottom of the page shouldn't be there.

p. 105 "In the first line of the function, you specify definition variable names": I think this was supposed to be "In the first line of the function definition, you specify variable names".

pp. 111-112 There are five occurrences of the number 273.14999999999998. In all five cases Python 3.1.1 gives me 273.15. This is due to Issue 1580 ("Use shorter float repr when possible").

p. 117, 118, 127 There are three occurrences of the number 3.1415899999999999. As above, these should be 3.14159.

p. 118 "you can also specifically ask for names from a module to be imported in such a manner that you don’t have to prepend it with the module name": this should say "prepend them".

p. 119 "But if a list of names called __all__ exists in the module (or the package’s, then the names are the ones imported, whether they begin with an underscore or not.": I think this would be considerably more clear if it said "then the names given in this list are the ones imported".

p. 121 "See the section on environment variables in the appendix for examples of": this should say "in the documentation".

p. 121 "You also may have to move or create a mymodules.pth file": the file shown in Listing 10.2 is called "myModules.pth", so I guess one of the two has to be changed.

p. 123 "long, list, tuple, cmp": "long" and "cmp" should be removed, as they are not part of Python 3.

p. 126 "exit local: {'y': 2, 'x': 2, 'w': 6}": since your function actually prints list(locals().keys()) the output will not be what you show but "exit local: ['y', 'x', 'w']".

p. 126 "cmp" should not be part of the output of dir(__builtins__).

p. 127 "Those ending in Error and System Exit": perhaps this was supposed to say "Those ending in Error and Exit".

p. 130 "hello": this is described as the "output of". However, the output of is "this is our first test script file".

p. 132 "which is True by default (action=store_false)": there should be quotation marks around "store_false".

pp. 138-144 In all the listings you write "#! /usr/bin/env python3.1" which based on what you said on p. 135 is probably because Python 3.1 is not the default on your system. However, when you run the scripts corresponding to Listings 11.10, 11.11, 11.13, and 11.14 on the command line in every single case you use python instead of python3.1. If this is because throughout the chapter you would like to simply use python on the command line, then for the sake of consistency I guess you should change all the occurrences of "#! /usr/bin/env python3.1" to "#! /usr/bin/env python" (obviously, excluding the note on p. 135 where you explain what to do if python3.1 is not the default).

p. 139 "This UNIX shell will find all": I think it's kind of excessive to call that one line a "UNIX shell". Perhaps "This script when run on a UNIX shell will find all".

p. 142 "import sys, string, optparse": it's not obvious to me that you need to import string here.

p. 151 "The arguments to os.path.join need not be single a directory or filename": this should say "need not be a single directory or filename".

p. 152 "os.path.commonprefix(path1, path2, ...) finds the common prefix (if any) for a set of paths.": this shows commonprefix as taking more than one positional arguments. Also, the use of the word "set" in this explanation may be misleading. The Python documentation shows commonprefix using a list, but I just checked and one can use (), {}, or [], as long as it's all one argument, i.e. os.path.commonprefix([path1, path2, ...]), etc.

p. 155 "'a.tmp', '1.tmp', '7.tmp', '9.tmp', 'registry.bkp.old']": this line should start with a "[".

p. 156 "See the appendix for the details of its use.": this should say "See the documentation for the details of its use."

p. 156 "to all the directories contained in the top parameter.": since you introduce os.walk by writing os.walk(directory, topdown=True, onerror=None, followlinks=False) I guess this was supposed to say "the directory parameter".

p. 157 "See the appendix for details.": similarly, this should say "See the documentation for details.".

p. 158 "os.makedirs": to be consistent with the rest of the table, this should say "os.makedirs(path)".

p. 158 "os. walk(path)": this should say "os.walk(path)".

p. 158 The table should also include an entry for os.remove(path).

p. 162 "myfile.write("Hello")": in all previous examples "myfile" has been a filename, so it might be confusing to the reader to use it here as a file object. Perhaps it would be best to say "file_object.write("Hello")".

p. 166 "a C double float": I don't think this terminology is widespread. Most people would say "a C double" or if you want to make the connection with the precision of the floating point, then "a C double-precision float" or "a C double -precision floating-point number".

p. 169 "contains function sole, save, show": this should say "functions".

p. 169 "if _sole_mem_cache_d.has_key((m, n, t))": similarly to what I pointed out above in connection to p. 24, this should be changed to "if (m, n, t) in _sole_mem_cache_d".

p. 169 There are three instances on this page of opening a file with "r" and "w" that should be "rb" or "wb", respectively. Similarly, there are two instances of this on p. 168 and two instances on p. 167.

p. 178 "from the __builtin__ module": this should say "from the __builtins__ module".

p. 179 "no exceptions are thrown to be caught by the try statement": I guess here you meant to say "no exceptions are thrown to be caught by the except clauses".

p. 179 "Nothing else occurs.": you also have a "finally:", so the "finally_body" will also be executed.

p. 180 "the line except exception_type, var:": as you show on the previous page, and as explained in PEP 3110, in Python 3 in this context we don't use the comma, but use "as" instead, which means that this should be "the line except exception_type as var:".

p. 181 "(error.args[2],": the "(" at the beginning should be removed.

p. 181 "if __debug__ is false": this should say "False".

p. 182 "def save_to_file(filename) :": this isn't an erratum per se, but for the sake of consistency you should probably follow PEP 8's recommendation to "avoid extraneous whitespace [...] Immediately before a comma, semicolon, or colon".

p. 184 "return function, (x, y, spreadsheet)": given what you say in the preceding discussion, I guess this should be "return function(x, y, spreadsheet)".

p. 185 "combined with a context management (in this case a file object)": given the terminology you've introduced, this should probably say "a context manager".
naomi.ceder (134) [Avatar] Offline
Re: Errata list for chapters 8-14

Thanks again for all the fixes/suggestions. I'll work through these and they will be added to the errata list and incorporated into coming editions. I really appreciate the the time and effort it takes to write them up and they will improve the quality of the book.

I saw your Amazon review the other day. Many, many thanks for that. I thought that you really understood what I was trying to do and I think your criticisms were qutie fair.

Again, thanks for everything!