Errata: November 22, 2018

Thank you for purchasing The Quick Python Book, Third Edition. Please post any errors, other than those listed below, in the book's Author Online Forum. We'll update this list as necessary. Thank you!


Page 31, listing 3.2

The last line should be:

print(line)

Page 73

The previous "Hello World" example produces two string objects, one of which is immediately discarded.

should be:

The previous "Hello World" example produces three string objects, two of which are immediately discarded.

Page 80, Python 3 update

Lines 3 through 5 reference Python 2.7 string constants, which aren't available in Python 3. This line should read:

string.ascii_lowercase contains all lowercase ASCII alphabetic characters; string.ascii_uppercase contains all ASCII uppercase alphabetic characters; string.ascii_letters contains all the characters in string.ascii_lowercase and string.ascii_uppercase.

Page 86

There's a missing closing parenthesis in the last line of code in the sidebar.

>>> print("a", "b", "c", file=open("testfile.txt", "w")

should be:

>>> print("a", "b", "c", file=open("testfile.txt", "w"))

Page 107

A block containing a single line may be placed on the same line after the semicolon of a clause of a compound statement:

should read:

A block containing a single line may be placed on the same line after the colon of a clause of a compound statement:

Page 125

Cueball 4 is misplaced. This cueball should go with the last three lines of code.

Page 148

The reference to file-input in the Quick Check table should be fileinput.

Page 149

This book focuses on running Windows from a command prompt or PowerShell.

should be:

This book focuses on running Python on Windows from command prompt or PowerShell.

Page 165

Replace os.path.isdir(os.path.join(path, os.pardir, os.curdir)) with os.path.isabs(os.path.join(os.pardir, path)).

Page 166

On most operating systems, this directory includes variables related to paths...

should be:

On most operating systems, this dictionary includes variables related to paths...

Page 173

Change base to basename in the third line of the following:

os.path.split(path): "Splits the path into a base and tail (the last element of the path)" 
os.path.splitext(path): "Splits the path into a base and a file extension" 
& 
os.path.basename(path): "Gets the basename of the path" 

Page 195

Line 16 of the code has a typo. ModuleNoteFoundError should be ModuleNotFoundError.

Page 217

Inheritance also comes into effect when you attempt to use a method that isn't defined in the base classes but is defined in the superclass.

should read:

Inheritance also comes into effect when you attempt to use a method that isn't defined in the subclass or derived class, but is defined in the superclass.

Page 220

The 7th line of code from the top should be:

self.__class__.all_circles.append(self)

Page 226

Instance C's namespace contains...

should be:

Instance c's namespace contains...

Page 236

The last z in the first line of code should be uppercase.

[-a-zA-z]

should be:

[-a-zA-Z]

Page 244, Figure 15.2

To clarify the difference between the two middle boxes in the first level (Superclass class variables) add the following parentheticals, respectively:

  • Superclass class variables (read)
  • Superclass class variables (write)
  • Page 286

    The sentence

    You'll have noticed that all the directories in your package-mathproj, mathproj/ comp, and mathproj/numeric...

    should read

    You'll have noticed that all the directories in your package-mathproj, mathproj/ comp, and mathproj/comp/numeric...

    Page 305

    In the second paragraph after the code snippet, $where date=between...should be $where=date between....

    Toward the bottom of the page, the following sentence has an erroneous ' character at the end of the url: The URL that the request actually sends is https:// data.cityofchicago.org/resource/6zsd-86xi.json?$where=date%20between%20% 222015-01-10T12:00:00%22%20and%20%222015-01-10T14:00:00%22'.

    Delete the ' at the end.

    Page 324

    The sentence "Create a Table object called data, giving the table's name in the database..." should read "Create a Table object called people, giving the table's name in the database...".

    Page 340

    In the middle of the first paragraph in section 24.2.2 Executing code in a cell, the instructions "...click the Run button immediately to the left of the down arrow on the button bar..." are incorrect. The button is to the right of the drop down arrow.

    Page 341

    In the first sentence of the third paragraph the word tabular is misspelled (tablular).

    Page 357

    The line "If we look at section VII of the readme.txt file we can see that the format of the inventory file is:" should be normal body font, not code font.

    Page 376

    There's a note that the following url is empty: http://barry.warsaw.us/software/STYLEGUIDE.txt. When the book went to press, this was true. The url is no longer empty.

    Page 393, B.2 Chapter 5 section

    There's an erroneous s in the following line:

    len([[1, 3, [4, 5], 6], 7 s]) - 2

    it should be:

    len([[1, 3, [4, 5], 6], 7]) - 2

    Page 402

    The Try This solution at the top of the page is missing the neutral option:

    if x < -5:
        print("very low")
    elif x < 0:
        print("low")
    elif x == 0:   # could be 'elif not x:' but the point here is comparison to 0
        print("neutral")
    elif x <= 5:
        print("high")
    else:
        print("very high")

    Page 413

    There's no answer to QUICK CHECK: CONTEXT MANAGERS. D is the correct answer. Please insert "Answer" followed by "D is the balance between too many and too few."