Errata

Think Python

Errata for Think Python, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
PDF
n/a

In the BOOKMARK section of my PDF reader ---

Clicking on any bookmark takes me to it's part of the document except for the bookmark named COVER which has no effect.

I tried using several different PDF readers and got the same result.

Richard Fursa  Mar 03, 2016  Nov 10, 2023
Page Chapter 9
Moby project by Grady Ward

This chapter contains a website link that is clearly not maintained by the publisher: thinkpython2.com/code/words.txt.

This is a serious error for a publisher of technical material. URLs can be malicious or put new computer users at risk. O'Reilly or any reputable publisher should provide safe reliable links.

Note from the Author or Editor:
We had to move the links to another domain. If you replace thinkpython2.com with thinkpython.com, it should work. That is, just delete the 2 from the URL.

Sorry, this was not deliberate!

Anonymous  Nov 01, 2023  Nov 10, 2023
Page 15
Where it says "throatwarbler"

The text says:

>>> first + second
throatwarbler

whereas it should be

>>> first + second
'throatwarbler'

Note from the Author or Editor:
Will fix. Thanks!

Anonymous  Apr 01, 2022  Nov 10, 2023
Page 28
Figure 3-1 - Stack Diagram

The text says: 'Bing tiddle tiddle bang.'. However, a quick google search reveals that the correct word is 'Bing tiddle tiddle bong'. That is, it's 'bong' and not 'bing'.

Note from the Author or Editor:
Will fix in next edition.

Anonymous  Apr 01, 2022 
Printed
Page 33
Exercise 3-2

The error is in the solution link.

IS: do_twice(print_twice, 'spam')

SHOULD BE: do_twice(print, 'spam')

Similarly,

IS: do_four(print_twice, 'spam')

SHOULD BE: do_four(print, 'spam')

Anonymous  Mar 19, 2019  Nov 10, 2023
Page 36
3rd paragraph

On page 36, in third paragraph, it doesn't state that 'mainloop' method must be stated at the very end of the script(as pointed out in documentations) provided before. This causes turtle screen to do nothing and makes unable to continue reading/studying in this chapter.

Note from the Author or Editor:
Sorry for the confusion. This will be fixed in the next edition.

Otar Gordeladze  Apr 09, 2022 
PDF
Page 39
mid way

text shows --- alice=Turtle(). Using this results in "'Turtle' is not defined" --- alice=turtle.Turtle() works.

Note from the Author or Editor:
Confirmed. I made a correction in Chapter 4 on Atlas.

10kLakes  Mar 15, 2016  Nov 10, 2023
Page 41
Bottom

"We could generalize polygon to take an angle as a
third argument, but then polygon would no longer be an appropriate name!" should be: "We could generalize polygon to take an angle as a
*fourth* argument, but then polygon would no longer be an appropriate name!"

Note from the Author or Editor:
Will fix. Thanks!

Anonymous  Apr 02, 2022  Nov 10, 2023
Page 95
Exercise 8-3

"A step size of 2 means every other character; 3
means every third, etc."

typo?

Note from the Author or Editor:
Will clarify. Thanks!

Anonymous  Apr 07, 2022  Nov 10, 2023
ePub
Page 98
In several places on this page and in the glossary at the end of the chapter

The definition of floor division is not quite right. You refer to it both as rounding down and dropping the fraction part (truncation). The dropping the fraction part is only true for positive numbers. If one of the numbers is negative the result is rounded down to the next integer less in value. Here is an example:

$ python
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 3//2
1
>>> -3//2
-2
>>>

In the first case the floor division is the same as truncation. In the second case it is not.

Note from the Author or Editor:
I will clarify this. Thanks!

Erik Johansson  Jul 16, 2017  Nov 10, 2023
PDF
Page 117
Middle of the page

In the example following the text ---

append modifies the list and returns None:

>>> t3 = t1 + [4]
>>> t1
[1, 2, 3]
>>> t3
[1, 2, 3, 4]
>>> t1

What is the point of having the final >>> t1?
It seems like it doesn't need to be there.

Note from the Author or Editor:
I've made changes in Chapter 10 on Atlas and rebuilt.

10kLakes  May 30, 2016  Nov 10, 2023
PDF
Page 122
Exercise 10-10

The description of the 'in_bisect' function states that it is to return the index of the target word in the list, if it exists, or 'None', if it doesn't. The solution provided at the link given at the end of the exercise, instead, returns 'True' if the word is in the list, or 'False' otherwise.

Modifying the solution so that it behaves as specified seems less than trivial, as the index 'i' refers to a list that changes with each iteration of the function, and not the original list.

Note from the Author or Editor:
I have made a correction in Atlas.

RobJones  May 08, 2017  Nov 10, 2023
Printed
Page 151
Exercise 13.1 in the output of the interactive code

Think Python, 2nd edition, Exercise 13-1, Hint near bottom of page 151 has this:

>>> import string
>>> string.punctuation
'!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~'

The third line, the output, should contain a backslash before the single quote within the string, and therefore should be:

'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'

Glenn A. Richard  Feb 26, 2019  Nov 10, 2023
PDF
Page 226
1st paragraph

The name of the exception mentioned in this paragraph is StopIteration. The text says StopException (last word of the paragraph).

Note from the Author or Editor:
I have made a change on Atlas.

Luciano Ramalho  Mar 01, 2017  Nov 10, 2023