Errata
The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update
Version | Location | Description | Submitted by | Date submitted |
---|---|---|---|---|
Other Digital Version | Page 56 of 708 Python Code |
The code imports float parameters from 'floats-10M-lines.txt'. The code in the book implies the file comes from the last code written where the imported 'array' library was used to generate 10 million float parameters. However using numpy (1.13.1) loadtxt method it is not possible to load the previously created file. More over when creating a numpy array with 10 million parameters and saving it to txt, the code still failts to import the content. |
Javier Granados | Oct 21, 2018 |
Printed | Page Page 13 Table 1.2 |
In the table, several of the methods have the wrong names. For example: |
Leam Hall | Jul 01, 2022 |
Page Page 222 Example 6-18 |
The example is given as follows: |
Mamatkasym | Sep 16, 2023 | |
Page code-demo:16-17 in the 'averager()' function |
The issue is that the `return Result(count, average)` statement is placed inside the `while` loop in the `averager` function. This placement is incorrect because using `return` inside the loop causes the generator to terminate immediately, and the values of `total` and `count` get reset on each iteration. |
DarrenYing | Sep 26, 2023 | |
Printed | Page Example 8-13 Bottom example |
In the lines: |
Daniel S Cox | Jan 22, 2024 |
Printed | Page Page 45 2nd paragraph from bottom |
It is not true that there must be a list after the lambda keyword in Scheme. It can simply be a variable name, in which case it will contain a list of all the arguments passed to the function. For example, the following is perfectly valid: |
Brian Adkins | Feb 19, 2024 |
Printed, O'Reilly learning platform | Page Preface, footnote 1 Bottom of page (print version 1) |
The URL in the footnote, that’s intended to go to the quote of Tim Peters, is incorrect. This platform prohibits the inclusion of URLs, so I’ll say that the page should be 134521.html rather than 147293.html |
Louise Penberthy | Apr 09, 2024 |
Printed | Page 2nd ed, P 456, ex 13-7 3rd line |
Very minor, but the comment for the inspect() method says it returns a sorted tuple. It doesn’t seem to. The implementation of the abstract method load() could potentially do that. However, its comment doesn’t say anything about sorting. |
Bill Arduser | Apr 18, 2024 |
Printed, PDF | Page 30 if longitude <= 0: limits the output to metropolitan areas in the Western hemisphere. |
The dividing line between the eastern and western hemispheres is -20, not 0 |
杨可 | Sep 11, 2020 |
Printed | Page 32 Line 4/5 |
In response to Brian van den Broek: There is a line break in the midst of an identifier. It should be "City(*delhi_data)"; the line breaks after " del". |
fracjackmac | Apr 08, 2016 |
Printed, PDF | Page 67 the last line |
b OrderedDict.popitem() removes the first item inserted (FIFO); an optional last argument, if set to True, pops the last item (LIFO). |
杨可 | Sep 16, 2020 |
Printed | Page 70 2nd to last paragraph |
liscomps -> listcomps (missing t) |
Richard Pattis | Aug 11, 2019 |
Printed | Page 93 Last paragraph (bird quote) |
The random salt is a security measure to prevent not only a DoS attack. I'd say to prevent a brute-force attack, which might end up being a DoS attack or anything else. A DoS attack is quite specific. |
Michalis Despotopoulos | Aug 11, 2020 |
PDF, ePub | Page 95 Bottom |
In the note about the custom __eq__ method, the second reference to this method calls it __eq$__. The dollar sign should not be there. |
Matthew Halverson | May 26, 2016 |
Printed, PDF, ePub | Page 95 bottom |
In the note about the custom __eq__ method, the second reference to this method calls it __eq$__. The dollar sign should not be there. |
Matthew Halverson | Jun 04, 2016 |
Printed | Page 111 around middle of page |
"Example 4-7. Decoding from str to bytes: success and error handling" |
Anonymous | Feb 27, 2018 |
Printed | Page 147 2nd line |
The second line ends with '__in' and the third starts with 'it__'. There should not be a line break, there as '__init__' is an identifier. |
Brian van den Broek | Mar 21, 2016 |
Printed | Page 151 Example 5-15 Function to shorten a string by clipping at a space near the desired length |
To clip near the desired length, when the space is not found before max_len the function should search for the space from left to right, starting from max_len. Thus text.find() should be used instead of text.rfind(). That is, |
Hao Wang | Jun 04, 2021 |
Page 154 Example 5-19. Annotated clip function |
The `rfind` method in `space_after = text.rfind(' ', max_len)` should be `find`. |
Jian Lan | Sep 08, 2017 | |
Printed | Page 155 Example 5-11, item tagged #5 |
The example tagged #5 in Example 5-11 is: |
Sam Roberts | Apr 05, 2020 |
Printed | Page 177 in example 6-2 |
watermelon is misspelled watermellon |
Matt Savoie | Apr 02, 2017 |
Page 211 general note |
Misspelled @singledispath, missing a C letter |
Juracy Filho | Feb 20, 2020 | |
Printed | Page 235 2nd paragraph |
atributes -> attributes |
Jürgen Gmach | Feb 09, 2018 |
Printed | Page 243 Explanation of Example 8-21 |
In step 4 |
Moe | Feb 08, 2017 |
Printed | Page 247 Object Destruction and Garbage Collection, last paragraph |
"Python Garbage Collector Implementations: CPython, PyPy and GaS" (http://bit.ly/1Gt0HrJ) |
Anonymous | Feb 22, 2016 |
Printed | Page 247 5th paragraph / last paragraph of Object Destruction and Garbage Collection |
In response to Anonymous: "Python Garbage Collector Implementations: CPython, PyPy and GaS" (http://bit.ly/1Gt0HrJ) links to a 404 page (https://thp.io/2012/python-gc/python_gc_final_2012-01-22.pdf) |
fracjackmac | Apr 08, 2016 |
Printed | Page 252 4th paragraph |
In the second line of the section "Parameter Passing: ..." where it says ... "This not wrong ..." it should be ... "This is not wrong ..." |
Guillermo Irisarri | May 17, 2018 |
Page 258 2nd paragraph and Example 9-8 |
Vector2d.__hash__ - method does not work correctly |
Ait | Nov 02, 2016 | |
Printed | Page 258 __eq__ and __hash__ definitions |
There seems to be a "didactic" inconsistency in the way that the __eq__ (page 258) and __hash__ (page 268) are defined. Why not use |
Guillermo Irisarri | May 17, 2018 |
Printed | Page 259 Footnote 3 |
The following concerns the third release (2016-03-18) of the first edition August 2015 (printed): |
Werner Wenzel | Sep 17, 2017 |
Printed | Page 262 1st paragraph |
About half way in the paragraph, where it says " ... so you want to them nearby ..." it should say something like "... so you want to place them nearby ...." |
Guillermo Irisarri | May 17, 2018 |
Printed | Page 269 The Problems with __slots__ |
"You must remember to redeclare `__slots__` in each subclass, because the inherited attribute is ignored by the interpreter." |
Anonymous | Feb 22, 2016 |
Printed | Page 286 first paragraph |
The function name "isinstance" is mispelled as "insinstance". |
Pascal Ortiz | Jul 29, 2016 |
Page 288 Vector Take #4: Hashing and a Faster == |
Vector.__hash__ - method does not work correctly because gives same hashes for different vectors |
Anonymous | Nov 02, 2016 | |
Printed | Page 289 Code at the top of the page, line 5 |
The code disallows all lowercase, single letter names, such as a, z or δ. |
Anonymous | May 01, 2018 |
Printed | Page 293 code in the __hash__ method |
map(hash, self._components) should be map(hash, self) because instances of the Vector class are iterable. |
Anonymous | May 01, 2018 |
Printed | Page 297-302 Code for Vector class |
Finale Vector class is missing __setattr__ method discussed on page 288-289. |
Anonymous | May 01, 2018 |
Printed | Page 304 2nd paragraph |
"...the subjects of Chapters 11 and 11." |
Oleg Marshev | Sep 16, 2018 |
Printed | Page 307 David Epstenin's comment on Evan Simpson's code |
It is clear that Simpson's code has been transcribed incorrectly, but if you change the name of the variable from t to total, or viceversa, remember to change it also in David Epstein's comment just below that code. |
Anonymous | Apr 09, 2016 |
Printed | Page 310 2nd paragraph under section "Interfaces and Protocols in Python Culture" |
"...the set public attributes..." needs "of" inserted between "set" and "public". |
Dean Draayer | May 26, 2016 |
Printed | Page 312 UML diagram in center of page |
Why is __len__ omitted from the Sequence ABC? |
Anonymous | May 01, 2018 |
Printed | Page 319 4th and 6th paragraph |
The function name "isinstance" is mispelled as "insinstance". |
Pascal Ortiz | Jul 29, 2016 |
Printed | Page 320 2nd paragraph of "Interfaces and Protocols in Python Culture" |
> every class has an interface: the set public attributes ... |
Nick Cleaton | Apr 10, 2019 |
Printed | Page 321 Penultimate paragraph |
Protocol is misspelled 'procotol' in italics. |
David | Apr 25, 2018 |
Printed | Page 322 1st paragraph |
Half way through paragraph where it says "... accepts an "an object conforming to ..." , remove the first 'an' to read "... accepts "an object conforming to ..." |
Guillermo Irisarri | May 23, 2018 |
Printed | Page 323 Example 11-3 |
in the book: |
tony tang | May 26, 2016 |
Printed | Page 323 2nd paragraph after Example 11-3 |
Where it says "... in the absence __iter__ ..." should say "... in the absence of __iter__ ..." |
Guillermo Irisarri | May 23, 2018 |
Printed | Page 325 1st paragraph |
The function name "isinstance" is mispelled as "insinstance". |
Pascal Ortiz | Jul 29, 2016 |
Printed | Page 325 code note (3) on example 11-6 |
It says " deck can now be sorted" but the example is about shuffling, not sorting. |
Nick Cleaton | Apr 10, 2019 |
Printed | Page 330 Interpreter session in upper half of the page |
There is an extra line of output |
Anonymous | May 03, 2018 |
Printed | Page 330 First line, and again approximately two-thirds into second paragraph. |
The function name "isinstance" has been written as "insinstance". |
Peter Ryan | Feb 09, 2019 |
Page 331-332 Paragraph above code for BingoCage |
The text claims that BingoCage overrides inspect, but this is not true. |
Anonymous | May 03, 2018 | |
Printed | Page 332 last method in code block |
The implementation of BingoCage here defines the following __call__ method: |
Ryan Rubin | Mar 13, 2017 |
Printed | Page 333 Middle of class LotteryBlower definition. |
Error message of raise LookupError is "pick from empty BingoCage" It should be "pick from empty LotteryBlower" because this function is in the LotteryBlower class. |
Charles Henri Darakdjian | Jun 09, 2017 |
Printed | Page 333 1st paragraph |
In the suggestion element, around the previous to last line, where it says "... a binary search using bisect function ..." should read " ... a binary search using the bisect function ..." |
Guillermo Irisarri | May 23, 2018 |
Printed | Page 334 MappingView entry |
"the mapping methods .items(), .keys(), and .values() inherit from ItemsView, ValuesView, and ValuesView, respectively." |
David | Apr 25, 2018 |
Printed, PDF | Page 334 Item 3 of bullet list |
Hi Luciano, |
Nilo César Teixeira | Dec 03, 2020 |
Printed | Page 335 Chapter 11 |
On UML diagram (figure 11-5) list class should not have __bool__ method. |
Max Lo | Mar 25, 2017 |
Printed | Page 335 1st paragraph |
In the first line insinstance should be isinstance. |
Guillermo Irisarri | May 23, 2018 |
Printed | Page 336 Bullet point 3 on top of page and footnote 15 at bottom of page. |
In bulletpoint 3, the text claims that TomboList inherits __bool__ from list. |
Anonymous | May 03, 2018 |
Printed | Page 343 Example 11-13 |
in the pick() method: |
tony tang | May 27, 2016 |
Printed | Page 363 2nd paragraph, second line of paragraph (l. 8 of the page) |
There is an extra right parenthesis in the text. The first sentence of the second paragraph starts: |
Rami Luisto | Jun 03, 2021 |
PDF, | Page 380 First 3 paragraphs of "Overloading * for Scalar Multiplication" section |
In the 1st paragraph, the book writes "If x is a number, that would be a scalar product [...]" However, in mathematics, "scalar product" actually means the same thing as the dot product. The correct term to use would be "scalar multiplication" as in the section heading. |
Jonathan Yong | Apr 28, 2020 |
Page 390 Top of page |
The warning box notes that the Python documentation doesn't say that the default behavior for __ne__ in Python 3 is the inverse of __eq__. However, it seems the documentation has been updated to reflect this fact, so this warning box could be removed in a future edition. |
Paul Romano | Sep 12, 2017 | |
Printed | Page 395 Last paragraph before scorpion remark. |
In the last sentence in the last paragraph before the scorpion remark on page 395 we have possibly small text formatting error where a space and an underscore have switched places. The last sentence says: |
Rami Luisto | Jun 05, 2021 |
Printed | Page 412 A Glimpse at Lazy Evaluation |
The code call outs for 1, 2, 3 in the stack trace should be reversed, with (3) appearing on the highest line, (2) the middle line, and (1) the lowest line. More concretely, the code description for "The Vector call gets a generator expression as its components argument. No problem at this stage." should be paired with the lines in the code |
Nate Guerin | Mar 14, 2017 |
ePub | Page 414 Table 14-3 and following text |
|
Gregory Sherman | Nov 17, 2018 |
ePub | Page 418 Table 14-5 and Example 14-21 |
|
Gregory Sherman | Nov 17, 2018 |
Printed | Page 420 Step 11 |
I think "next(it)" should be "next(g)". |
Dean Draayer | May 26, 2016 |
Printed | Page 425 2nd paragraph after ending numbered list |
It reads |
Alexey Tereshenkov | Aug 12, 2017 |
Printed | Page 431 Second numbered item (enumerated 11) |
It seems the author meant next(g) and not next(it), as appears in items 5, 6 and 9 in the previous page, the equivalent in the for loop is formulated as g = iter(gen_AB()). |
Yonathan Mizrahi | Jan 20, 2019 |
Printed | Page 437 1st paragraph |
Duplicate word in "reduce the cumulative effect of errors when working with with floats". |
William Smith | Nov 03, 2019 |
Printed | Page 448 Second code example |
The sample code in the book |
Alexey Tereshenkov | Aug 12, 2017 |
Printed | Page 452 3rd line of 5th text paragraph after title "A closer look at the iter function" |
(1st Edition, 3rd Release of printed version) |
Anonymous | Nov 21, 2018 |
Page 469 last paragraph + item 5 in example 13-15 |
As of python3.11, the |
MohammadSaleh Dehqanpour | Jan 18, 2024 | |
Page 480 definition of `grouper()` |
As written, it is not exactly clear why the while True loop is required in grouper (i.e., the delegating generator): |
Yong Jie | May 31, 2020 | |
Printed | Page 480 2nd paragraph, first line of paragraph (l. 3 of the page) |
The second paragraph of the page, just above the next section header, starts with: |
Rami Luisto | Jul 19, 2021 |
Printed | Page 509 Figure caption |
In the caption for figure 16-3, it notes that "Colored arrows highlight taxi trips", but there is not color in the printed version. |
Matthew Halverson | Jun 04, 2016 |
Page 541 First paragraph |
Spelling error. "were" should be "where" in the sentence: |
Peter Goldthorpe | Jul 07, 2019 | |
Other Digital Version | 544 Example 17-12 |
In the book: |
Zbigniew Halas | Dec 02, 2016 |
Printed | Page 559 First paragraph |
The link on line 3 of the text (https://bit.ly/1Ox3vWA) seems to lead to a different discussion that the author is describing (even with the variations '10', 'lO', 'l0' of the first two letters after 'bit.ly/'). |
Rami Luisto | Aug 10, 2021 |
Page 564 1st paragraph |
Replace the with than |
Dani | Mar 12, 2023 | |
Printed | Page 577 def get_flag(base_url, cc); |
in the book, the function is implemented as: |
tony tang | Jun 21, 2016 |
Printed | Page 578 5th bullet point |
""When this with statement exists, the semaphore counter is decremented, unblocking some other coroutine instance that may be waiting for the same semaphore object." |
David Malvar | Feb 17, 2021 |
Other Digital Version | 585 3rd paragraph under "Boolean Value of a custom Type" |
On the kindle digital version the paragraph indicated states "Our implementation of __bool__ is conceptually simple: it returns False if the magnitude of the vector is zero, True otherwise". I have found this is not accurate (at least on python 3.6.1). The use of a Vector object with any magnitude value returns True. |
Javier Granados | Oct 20, 2018 |
Page 594 Last paragraph |
In discussing the __new__() special method, the book says "it's a class method". The Python 3 documentation actually indicates that it is a static method, not a class method (see https://docs.python.org/3/reference/datamodel.html#object.__new__). This can be confirmed by trying to call, e.g., float.__new__(). If __new__() were a class method, float would automatically be passed; instead, it has to be passed explicitly as in float.__new__(float). |
Paul Romano | Sep 09, 2017 | |
Page 595 First code block |
The use of __new__() is incorrect in the code example showing how object construction happens. The code is: |
Paul Romano | Sep 09, 2017 | |
Printed | Page 597 first paragraph |
Book states : |
Pascal Ortiz | Jul 26, 2016 |
Printed | Page 612 3rd (last) paragraph |
"[...] uses `name` as a key to retrieve an item from `self.__dict`" |
Alex Povel | Jun 29, 2020 |
Printed | Page 618 Last paragraph (right before Example 19-26) |
"@my_propety.deleter" is missing the "r" in "property". |
Dean Draayer | May 26, 2016 |
Page 621 First paragraph of chapter summary |
In the second sentence of the first paragraph of the chapter summary, it looks like there is a missing backtick on FrozenJSON: |
Paul Romano | Sep 13, 2017 | |
Printed | Page 626 Last line on the page (before footnote) |
'defauldict' should of course be 'defaultdict'. |
Dean Draayer | May 26, 2016 |
Printed | Page 637 The session display near the top of the page |
Where did the object referenced as "raisins" come from in the last line of the session presentation? It seems to have the same _Quantity#0 & 1 values as the object bound to "coconut", but I don't see any binding / creation of "raisins" |
Dean Stevens | Apr 09, 2016 |
Printed | Page 638 3rd to last paragraph |
"The code in Example 19-25 may be a bit tricky [...]" |
Alex Povel | Jul 02, 2020 |
Printed | Page 641 First line of first paragraph |
The first line on the page currently reads: |
Dean Stevens | Apr 10, 2016 |
Printed | Page 655 Penultimate paragraph in "Chapter Summary" |
It says '"Descriptor Usage Tips" on page 652 provided a brief look at how descriptor deletion and documentation work'. That is actually covered in the following section, starting on page 654. |
Dean Draayer | May 26, 2016 |
Printed | Page 657 test code at the bottom of the page |
in the book: |
tony tang | Jul 07, 2016 |
Printed | Page 657 Last 2 lines |
The last code snippet says `getattr(raisins ...` but it would make more sense to me to change raisins --> coconut as this is the above example. |
Anonymous | Dec 29, 2019 |
Page 667 Second to last paragraph |
The contextlib._GeneratorContextManager code shows that it does not suppress exceptions and if any exception is not handled by the generator function, it will be re-raised. (either literal raise or "return False" depending on the returning exception) |
MohammadSaleh Dehqanpour | Mar 22, 2024 | |
Page 669 Last paragraph |
The text says "Besides type, a few other metaclasses exist in the standard library, such as ABCMeta and Enum." The error is that Enum is actually not a metaclass; the standard library documentation actually indicates that there's a metaclass EnumMeta, of which Enum is an instance of. See https://docs.python.org/3/library/enum.html#enum-classes. |
Paul Romano | Sep 09, 2017 | |
Printed, PDF | Page 678 Chameleon sidenote |
Hi, |
Nilo César Teixeira | Dec 04, 2020 |
Printed | Page 689 2nd paragraph |
"..., from the team who brings us Flake, Sphinx, ..." |
andor_chen | Feb 25, 2016 |
Printed | Page 721 1st paragraph, right column |
As previously submited in the errata list, __new__ is not a class method (I know, this is misleading for the fisrt argument of __new__ being a class), so the sentence |
Pascal Ortiz | Jul 29, 2016 |
Page 820 callout |
"Using await in a list comprehension is similar to using asyncio.gather...." |
MohammadSaleh Dehqanpour | Jun 23, 2024 | |
Page 856 Second to last paragraph |
As of python 3.12, cached_property no longer uses a Lock. So this paragraph should be removed: |
MohammadSaleh Dehqanpour | Mar 21, 2024 | |
Page 877 Second to last paragraph |
PEP-8 recommends CapWords for class names not camelCase! |
MohammadSaleh Dehqanpour | Mar 21, 2024 | |
PDF, ePub, Mobi | Page 9912 text |
Current |
Anonymous | Sep 16, 2019 |
PDF, ePub, Mobi | Page 9912 text |
Current |
Anonymous | Sep 16, 2019 |
PDF, ePub, Mobi | Page 10672 text |
Current |
Anonymous | Sep 16, 2019 |
PDF, ePub, Mobi | Page 11905 text |
Current |
Anonymous | Sep 16, 2019 |
PDF, ePub, Mobi | Page 12620 text |
Current |
Anonymous | Sep 16, 2019 |
ePub, Mobi | Page 12620 text |
Current |
Anonymous | Sep 24, 2019 |
PDF, ePub, Mobi | Page 18749 text |
Current |
Anonymous | Sep 16, 2019 |
PDF, ePub, Mobi | Page 21768 text |
Current |
Anonymous | Sep 16, 2019 |