luke.bace (66) [Avatar] Offline
#1
Please post all errata here.
stefan.pochmann (1) [Avatar] Offline
#2
Re: Errors and Corrections
p. 13
(See “Basic Python interactive mode summary” at the end of the appendix.)

I can't find it, neither in the paper book nor in the pdf (having Adobe Reader searching it for me).
naomi.ceder (134) [Avatar] Offline
#3
Re: Errors and Corrections
Quite right - that reference was from the first edition, and the section mentioned was dropped in the second edition.

That material is now available in the Python documentation in Section 13 of the Python Tutorial, "Interactive Input Editing and History Substitution", available here:
http://docs.python.org/tutorial/interactive.html

So the entire statement in parentheses should be removed.

Thanks for the report!

Cheers,
Vern
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#4
Re: Errors and Corrections
top of p. 41: coerce was deprecated in python 2.6 and is no longer in python 3.1

p. 156, 12.4: second "if topdown is True" should be "if topdown is False". From the man page:
If optional argument topdown is True or not specified, the triple for a directory is generated before the triples for any of its subdirectories (directories are generated top-down). If topdown is False, the triple for a directory is generated after the triples for all of its subdirectories (directories are generated bottom-up).
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#5
Re: Errors and Corrections
p. 162 introduces reading a file as a bytes object.

Section 13.4.1 (on the very next page!) introduces the very same thing as if it were something new, using almost the same text.
naomi.ceder (134) [Avatar] Offline
#6
Re: Errors and Corrections
Thanks for the errata reports - I'll be sure to look at them for the next printing.

Thanks again for taking the time to report them!

Cheers,
Vern
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#7
Re: Errors and Corrections
Apologies if this doesn't count as an error, but (speaking as a long time perl enthusiast), all that the perl code example on p. 5 tells me is that you're probably not a perl programmer. <smilie

In all seriousness, these kinds of comparisons between languages are almost always a bad idea. This particular example almost made me lose confidence in the book. I forged ahead anyway, and discovered that it's actually a very good book on python (not perl). I would just leave this out in the next addition and state that python is readable with a python example only. Perl programmers find well written perl eminently readable, Eric Raymond's comments notwithstanding.
naomi.ceder (134) [Avatar] Offline
#8
Re: Errors and Corrections
No apologies needed - I'm grateful to have a thoughtful reader willing to give feedback!

And I'm OK admitting I'm not a perl programmer. However, that example is from the first edition, so I can't entirely take credit or blame for it. I did consider removing it, (because I'm not crazy about such language comparisons myself) but I left it in, because... well... it seemed like a good idea at the time. smilie

I'm well aware that expert perl programmers find well written perl quite readable, but I'm not sure that's where the argument lies. I wonder how the comparison would come out if we take rank beginners and show them average run-of-the-mill code. I know what my answer would be, but I sense maybe you wouldn't entirely agree... smilie

But either way, I agree - snarky language wars are one category of religious dispute we can do without these days.

Cheers,
Vern
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#9
Re: Errors and Corrections
p. 175. youcan't should be you can't
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#10
Re: Errors and Corrections
Another suggestion:

Ch. 14 and 15 should probably be in reverse order, since the Exception chapter (14) depends somewhat on the concept of Classes (e.g. inheritance), while the definition of Classes (15) is completely independent from the concept of Exceptions. Further, Classes and OO are central to Python, so by covering classes first, the Exceptions chapter becomes "now that you know about the core of python programming, here's how you handle exceptions" for better narrative flow.
naomi.ceder (134) [Avatar] Offline
#11
Re: Errors and Corrections
Not a bad idea, thanks. However, given the nature of the book business, a change like that would have to wait for another edition.
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#12
Re: Errors and Corrections
IGNORE THIS -- MY MISTAKE

Message was edited by:
pgoetz@mail.utexas.edu
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#13
Re: Errors and Corrections
p. 196 -- my mistake

Oops, never mind. If you're importing the code as a circle module, this is correct -- my bad. I was just running the whole thing interactively and completely overlooked the first line, import circle.
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#14
Re: Errors and Corrections
p. 207, bottom of 2nd paragraph:

the class definitions y look like this:

should be?

the class definitions look like this:
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#15
Re: Errors and Corrections
Ch. 20, p. 248, Listing 20.1

return "Color: R={0:d}, B={2:d}, G={1:d}".format (self._red, self._green, self._blue)

should be

return "Color: R={0:d}, B={2:d}, G={1:d}".format (self.red, self.green, self.blue)
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#16
Re: Errors and Corrections
p. 296.

This is a rather minor point, but in the line

return [b"Hello, World"]

the b binary preface is unnecessary, since you told the browser the charset would be utf-8. Also, isn't the use of double quotes here inconsistent, given that you're using single quotes in the preceding lines? In perl, I try to consistently use single quotes when no variable interpolation will occur, double quotes otherwise. I understand that interpolation doesn't apply in python, but there are probably some similar consistency suggestions.
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#17
Re: Errors and Corrections
OK, finished reading the book from cover to cover and I couldn't find anything else that hadn't already been spotted. Nice work.
reiki33 (5) [Avatar] Offline
#18
Re: Errors and Corrections
Chapter 8.3, the for loop.
The code definition fragment contains "for item in sequence:".
The text that follows says "variable is set to be the first ..."
Since variable is not in the code definition fragment, the word 'variable' in the rest of that paragraph should reference 'item', or at least "variable <code>item</code> is ...".

"is set to be" seems a little contorted. Is 'be' necessary? Perhaps simply, 'is assigned'? Sorry, I make notes in fiction books, too, for typographical errors when I encounter them.
naomi.ceder (134) [Avatar] Offline
#19
Re: Errors and Corrections
Thanks so much for reporting all of these! I appreciate it!
naomi.ceder (134) [Avatar] Offline
#20
Re: Errors and Corrections
Thanks for the notes... I agree on all counts!

Cheers,
Vern
pgoetz@mail.utexas.edu (20) [Avatar] Offline
#21
Re: Errors and Corrections
In re-reading some chapters, I found some additional typos:

Under Listing 15.2, p. 193

"""circle module: contains the Circle class."""

should be

""circle_cm module: contains the Circle class."""
rick_silva (2) [Avatar] Offline
#22
Re: Errors and Corrections
Chapter 17, page 227: "A complete list of special characters available in Python regular expressions as well as description of what they mean, is given in the appendix at the end of this book".

I can't find that in the appendix.

If that is online someplace, I would love to have the link.
naomi.ceder (134) [Avatar] Offline
#23
Re: Errors and Corrections
My apologies - we moved that content out of the book because it's more current in the online version. The best places to find this are the official HOWTO: http://docs.python.org/py3k/howto/regex.html

and the re library docs:
http://docs.python.org/py3k/library/re.html

Hope this helps!

Cheers,
Vern
rick_silva (2) [Avatar] Offline
#24
Re: Errors and Corrections
Thanks for the info. I really like the book. It has been very helpful to me.
naomi.ceder (134) [Avatar] Offline
#25
Re: Errors and Corrections
Thank you! Glad to hear you like the book!

Vern
BPODFW (1) [Avatar] Offline
#26
Re: Errors and Corrections
On page 25 when using Python 3.2.2 on Windows 7

The chdir does not work with os.join. It fails but

os.chdir(os.path.join("c:\", "Python32","test"))

works for instance. The pathing issue on windows requires two backslashes. It probably works on other platforms but windows balks.
naomi.ceder (134) [Avatar] Offline
#27
Re: Errors and Corrections
Thanks for the report - the way the example is set up in the book it will only work if current directory is the root of drive C:. That is, on Windows, unless you specify, when you give a drive letter os.path.join works relative to the the drive's current directory.

That needs to be fixed and explained in the future.

Thanks again for the error report!
rcanright (1) [Avatar] Offline
#28
Re: Errors and Corrections
p. 101, very last line reads
count, word_count, char_count))
should read
(line_count, word_count, char_count))
^^^^^^
naomi.ceder (134) [Avatar] Offline
#29
Re: Errors and Corrections
Good catch, you are quite right.

Thanks for the report!

Cheers,
Vern
mark.a.heinze@gmail.com (3) [Avatar] Offline
#30
Re: Errors and Corrections
Please disregard. I see Alex Gezerlis already reported the 'listd' error on pg 46 in July 2010.

Message was edited by:
mark.a.heinze@gmail.com
Aetius (8) [Avatar] Offline
#31
Re: Errors and Corrections
I'm running version 3.2.3 on a Windows 7 machine.

Page 151 of the second edition says:

Note that we could enter the pathname with forward slashes (/) as well because Python converts them before accessing the Windows operating system:

>>> import os
>>> print(os.path.join('mydir\bin', 'utils\disktools\chkdisk'))
mydirinutilsdisktoolschkdisk

I tested this by copying the example, but with forward slashes. This is what I got:

>>> print(os.path.join('mydir/bin', 'utils/disktools/chkdisk'))
mydir/binutils/disktools/chkdisk
naomi.ceder (134) [Avatar] Offline
#32
Re: Errors and Corrections
Yes, that doesn't look too surprising. It's not that it will convert them before joining the path (or printing the result), it's that Python will convert them before hitting the OS to do something, like opening a file or listing a directory.

Did you try to do something (using calls to the Windows OS) and have it fail with this string?

I have to admit I'm not a heavy Windows user, and I don't have a Windows 7 test machine available right now.
Aetius (8) [Avatar] Offline
#33
Re: Errors and Corrections
You're right. I tried both formats (double-backslash and forward-slash) to put together a file name. In each case, I was able to open the specified file and read the first line.
Aetius (8) [Avatar] Offline
#34
Re: Errors and Corrections
On page 164, a call to sys.stdout.write returns the given string and the number of characters in the string. But when I tried it (again, running version 3.2.3 on Windows 7), I got the following:

>>> import sys
>>> print("Write to the standard output."smilie
Write to the standard output.
>>> sys.stdout.write("Write to the standard output.
")
Write to the standard output.
>>>

Does this suggest a recent change to the language?
Aetius (8) [Avatar] Offline
#35
Re: Errors and Corrections
----Message deleted----

Message was edited by:
Aetius
naomi.ceder (134) [Avatar] Offline
#36
Re: Errors and Corrections
I don't think so. Are you using IDLE for that test, by chance? I just tried with Python 3.2.3 on Windows XP (yeah, our parent company is a little backward smilie ) and I got the expected behavior at a command prompt, but what you report when I used the IDLE shell. I'm not too surprised (well, I'm *slightly* surprised) that the IDLE shell is intercepting and handling that call a bit differently. Not reporting the byte count was standard in earlier versions of Python, so I'm guessing for portability/compatibility reasons they left it that way in IDLE for Python 3.x.

Thanks for the question - that one was a new one to me and took a bit of digging!

Cheers,
Vern
Aetius (8) [Avatar] Offline
#37
Re: Errors and Corrections
You nailed it. I was using IDLE when I noticed the problem, and, now that you mention it, the command prompt doesn't suppress the byte count.
Aetius (8) [Avatar] Offline
#38
Re: Errors and Corrections
I'm not sure that the errata thread is the best place to post this question, but here goes:

On page 231, the simple program for processing regular expressions uses the phrase "( (?P<middle>([-a-zA-Z]+)))?". Is the innermost pair of parentheses really necessary? That is, would "( (?P<middle>[-a-zA-Z]+))?" have been equally valid?
kandeler (8) [Avatar] Offline
#39
Re: Errors and Corrections
3.3.5 ("Function definition"), page 27:
funct4 declares a parameter "dictionary" and then refers to it as "dict".
kandeler (8) [Avatar] Offline
#40
Re: Errors and Corrections
4.3 ("Variables and assignments"), page 38:
"A full list of the possible exceptions and what causes them is in the appendix of this book." -> The appendix contains no such list.
kandeler (8) [Avatar] Offline
#41
Re: Errors and Corrections
5.7.3 ("Packing and unpacking tuples"), page 59:
"any number elements" is probably supposed to say "any number of elements"
kandeler (8) [Avatar] Offline
#42
Re: Errors and Corrections
8.6.2 ("Comparison and Boolean operators"), page 100:
"See the appendix for more details on precedence." -> There are no details on precedence in the appendix.

(It seems to me it would be a good idea to grep for "appendix" in the document from which the book was produced and check for more of these.)
naomi.ceder (134) [Avatar] Offline
#43
Re: Errors and Corrections
Thanks for catching the wording bugs and the errant references to the appendix. We removed a lot of things from the appendix for the second edition, on the theory that the online versions were both readily accessible and would stay more current. Of course that meant that many, many references to the appendix were rendered incorrect.

Believe it or not I did search for "appendix" (the book was in Word format, so grep wasn't really an option) more than once, as did my technical editor, but still sometimes things escape notice, so thanks for pointing out those for future correction!

Thanks for all the corrections!

Vern
naomi.ceder (134) [Avatar] Offline
#44
Re: Errors and Corrections
In that particular case, I'd agree that the expression would work the same if the innermost parens were removed. I guess it's due to a long teaching background (at least that's my guess) but I prefer to make things explicit with parens where there is any possibility for ambiguity later on... So I think I was probably thinking that the parens would be protection if the expression were extended later... But of course, at this point I don't remember and it could be I just put in an extra set of parens out of habit. smilie

Thanks for reading closely!

Cheers,
Vern
kandeler (8) [Avatar] Offline
#45
Re: Errors and Corrections
14.2.4 ("Defining new exceptions", page 181):
"create you own subhierarchy" should be "create your own subhierarchy"
kandeler (8) [Avatar] Offline
#46
Re: Errors and Corrections
15.10 ("Scoping rules and namespaces for class instances", page 201):
The first assignment (to the mv variable) in the cs.py module is missing a space after the assignment operator (not a syntax error, but most likely unintended).
kandeler (8) [Avatar] Offline
#47
Re: Errors and Corrections
16.9 ("Alternatives to Tkinter", page 221):
On the last line, "QT" should be "Qt". (Also on the first line of the next page.)
agezerlis (11) [Avatar] Offline
#48
Re: Errors and Corrections
>>but still sometimes things escape notice, so thanks for pointing out those for future correction!

What does "future" mean in this context? I posted dozens of corrections a full 2 years ago (which in the tech world is equivalent to millennia). Since then, many other readers have re-discovered many of them, posting their findings on this forum (and others caughts errors I didn't catch).

I understand that the timing of a second printing depends on too many factors, but producing a corrected ebook should not be that challenging. Obviously a new ebook should not be generated every single time a new typo is spotted -- error corrections should be batched. But still, 2 years?
kandeler (8) [Avatar] Offline
#49
Re: Errors and Corrections
> What does "future" mean in this context? I posted
> dozens of corrections a full 2 years ago (which in
> the tech world is equivalent to millennia). Since
> then, many other readers have re-discovered many of
> them, posting their findings on this forum (and
> others caughts errors I didn't catch).

It would definitely help if these findings were at least incorporated into the "Errata" document. As it is now, I have to browse through about half a dozen different documents to check whether the error I spotted has already been reported by somebody else.
bluesdiva (2) [Avatar] Offline
#50
Re: Errors and Corrections
Am using "Corrected printing, January 2013". Found two errors so far:

1. p.27 section 3.3.5 Functional definition, def of funct4, param 4 is "**dictionary", but reference in body of function is "dict". These identifiers should agree. I changed param 4 in the definition to be **dict, and then it ran fine.

2. p.28 section 3.3.6 Exceptions, the else: clause in your code refers to f.readline(), which at this point may be null if the file you are processing has only one line. Change f.readline() to line, so that the print statement is the following:
print("%s: %s" % (file, line))
naomi.ceder (134) [Avatar] Offline
#51
Re: Errors and Corrections
Thanks for the note.

On 3.3.5 you are quite right - the two should match.

For 3.3.6, it's actually a badly conceived example. If an exception occurred on the file open, with suggested change then line will not be defined and will throw another error when the else block executes. But actually, there are other scenarios where the current f.readline() will be equally bad. As I say, it's just a bad example. Even though it's not really supposed to do much, examples should at least be working code. My apologies.

Again, thanks for the bug report
Naomi (AKA Vern) Ceder
bluesdiva (2) [Avatar] Offline
#52
Re: Errors and Corrections
Thanks for the ack, Naomi. Got it.

I'm having trouble with tuples...
On pages 58-59, sections 5.7.2 and 5.7.3, I'm finding some examples
don't work the way the book shows they should.

ex.1 :
x = 3
y = 4
(x + y)
(x + y,)

If I use IDLE, the results are as in the book. If I make a .py file
and use print statements to do the last 2 things above, I get "7" for both.

ex. 2:
This is the packing/unpacking example -- I can't get anything
using the * syntax to work, either in IDLE or in a .py file. I can do
things like
one, two, three, four = 1, 2, 3, 4
but if I have unequal numbers of elements on either side of the assignment
operator, I get an error, whether or not I use the * notation as printed in the book.

I am using Python 3.3.2, in case that makes a difference.
naomi.ceder (134) [Avatar] Offline
#53
Re: Errors and Corrections
This is from a reader via email... adding here to make sure they are tracked:

I recently had to learn some Python and did so by reading parts of
your book "The Quick Python Book" 2nd ed. Your book was a very helpful
source and I actually quite like your style of writing.

Anyway, while reading it I found a few typos. I don't know if you're
interested in this list or not, in any case here it comes:

p. 46: listd --> list
p. 177: Indention of a few lines seems to be broken.
p. 187: assigns to the radius --> assigns a value to the radius
p. 190: "as a normal Python" sounds strange
p. 226: .. --> .
p. 229: that that --> that

English is not my mother tongue so maybe some of the errors are
actually "errors".
johnash (1) [Avatar] Offline
#54
Re: Errors and Corrections
Corrected Printing, January 2013 (Paper ):

p47 line -3 (typo): return: -> returns
511318 (1) [Avatar] Offline
#55
Page xxiii, sixth paragraph, last sentence: "We suggest you try asking him some challenging questions, lest his interest stray!" should read, "We suggest you try asking her some challenging questions, lest her interest stray!"

Page 314, fifth paragraph, "When writing English, Strunk and White apply." should read "When writing English, Strunk and White applies." Here "Strunk and White refers to the book, not to the authors, so it should be italicized, and the verb should be singular.