Programming in Python 3 (Second Edition)
Errata

ISBN-10: 0321680561 – ISBN-13: 978-0321680563
Second Edition: Errata for All Printings
Issue Resolution Reporter
none reported
Second Edition: Errata for the Second Printing only (additional to the errata above—these are all fixed in the Second and subsequent printings)
Issue Resolution Reporter
Page 34. Incorrect output. At the bottom of the page, change each occurrence of "number" in the output to "integer". Algis Kabaila
Pages 89 & 95. Update to footnote info. The footnotes on these pages point out the Window's console's poor UTF-8 support and notes that alternative examples (print_unicode_uni.py and quadratic_uni.py) are provided to work around this. Now Glenn Linderman has found a solution (that I've tested successfully with Python 3.1); see Python Bug 1602/message #94445. If the solution is followed, Windows users can use the same print_unicode.py and quadratic.py programs as Linux and Mac OS X users and see the same characters output. (Be aware though, that this may cause problems executing other programs in the console, so for anything else it is probably best to use a separate console.) Author
Page 90. Bug fix. The print_unicode() function has a subtle bug. Replace the line:
    end = sys.maxunicode
with the line:
    end = min(0xD800, sys.maxunicode) # Stop at surrogate pairs
This is because Python can't handle surrogate pairs and some of them
start at code point U+D800. This correction has been applied to the downloadable archives.
Hugo Gagnon
Page 258. Clarification. In the description of the reimplementation of the __repr__() method I say that it is necessary to call super().__repr__() to access the base class's __repr__() method without causing infinite recursion. That reason is true in general, but not in this particular case. Nonetheless, the code shown is correct. What I should have said is this:
"For the str.format()'s second argument we cannot just pass self. There are two reasons for this. First, if we use self, Python will format it using the __str__() method if that is present in this class or (as in this case) in one of its base classes, whereas we want the representational format rather than the string format. And second, if there is no __str__() implementation, Python will fall back to using __repr__(), thus leading to infinite recursion. By calling the base class's __repr__() method we ensure that we get the representational format and at the same time avoid depending on whether or not a __str__() method happens to be implemented."
Luca Boasso
Page 454. Incorrect URL. In the fourth paragraph, change the URL to code.google.com/p/python-safethread. Takahiro Nagao
Page 495. Incorrect footnote. Change the footnote to:
"Note that only numbered backreferences can be used inside character classes, that is, inside []."
Steve Andrews
Page 511. Incorrect sentence. The last sentence of the first paragraph after the code snippet is incorrect. Change it to:
"This is not easy, especially since only numbered backreferences can be used inside character classes."
Steve Andrews
Copyright © 2009-10 Qtrac Ltd. All Rights Reserved.