Think Python

Errata for Think Python

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

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 
Page 33
Exercise 3-2

The error is in the solution link.

IS: do_twice(print_twice, 'spam')

SHOULD BE: do_twice(print, 'spam')


IS: do_four(print_twice, 'spam')

SHOULD BE: do_four(print, 'spam')

Anonymous  Mar 19, 2019 
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 
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
>>> -3//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 
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 
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 
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 
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