Start any video training course for FREE. More than 500 to choose from. Learn more
Introducing Python

Errata for Introducing 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
ePub
Page loc.5900
to of "page", above time example

"The date module's time object is used to represent a time of day:" but the code uses the datetime module, not the date module. Sentence should refer to datetime?

Note from the Author or Editor:
I think you're correct, it should refer to datetime. That's what it's imported from.

robert montante  Nov 14, 2014  Feb 20, 2015
ePub
Page loc.4208
section "Structured Text Files", 3rd sentence

Should the sentence "You might want to save data for our program to use later..." read "You might want to save data for your program to use later..." ?

Note from the Author or Editor:
Ouch. Well, I guess it's "our" program if I'm in the room with you.I'll be right over.

robert montante  Nov 14, 2014  Feb 20, 2015
ePub
Page Loc 1182
Middle

letters[-1:0:-1] produces 'zyxwvutsrqponmlkjihgfedcb' not 'zyxwvutsrqponmlkjihgfedcba' To produce the latter string: letters[-1::-1]

Note from the Author or Editor:
Fixed this one and others in the slice section.

Richard Munde  Mar 07, 2014  Nov 07, 2014
ePub
Page Loc. 502
Top of page

1.0e8 does not mean "one to the eighth power or 100000000.0" since 1 to the eighth power is one. Rather it mean 1 times 10 to the eighth power which indeed is 100000000.0.

Note from the Author or Editor:
Corrected. Thanks!

Richard Munde  Mar 07, 2014  Nov 07, 2014
PDF
page 32: fifth and sixth paragraphs

letters[20:] is 'uvwxyz' not 'vwxyz' letters[12:15] is 'mno' not 'nop'

Note from the Author or Editor:
Fixed in Atlas.

Stephen Neuman  Mar 13, 2014  Nov 07, 2014
ePub
Page loc. 1568
"Things to do" 3.12

Problem 3.12 asks for a dictionary comprehension, but comprehensions aren't discussed until chapter 4.

robert montante  Oct 12, 2014  Nov 07, 2014
ePub
Page ??
About a quarter of the way down in the Comprehensions section

In the Comprehensions section, when beginning to introduce the ability to use conditional statements, it asks to find odd numbers between one and five. Instead it finds the numbers that when divided by 3, have a remainder of 1 (1 and 4). While this was confusing at first, it was helpful in understanding what that line of code did better.

Kyle Williams  Sep 30, 2014  Feb 20, 2015
ePub
Page loc. 1419
Figure 3-1

diagram of union: inner arc shouldn't be there; should be a single unified volume. diagram of intersection: the intersection should be shaded

robert montante  Oct 11, 2014  Nov 07, 2014
ePub
Page loc. 1421
sentence before section heding "Crfeate with set()"

"...an exanple of a null set..." should be "...an example of a null set..."

robert montante  Oct 11, 2014  Nov 07, 2014
ePub
Page loc. 1082
3rd paragraph after "Get a slice to Extract Items by Offset Range"

"The next exampe starts at..." should be "The next example starts at..." Also, why is "slice" not capitalized in the section heading?

robert montante  Oct 11, 2014  Nov 07, 2014
ePub
Page loc. 885
end of "Get Length wit len()" section

Last sentence reads "You can use len() with other sequence types, too, as is described see in Chapter 3." Word "see" should be omitted?

robert montante  Oct 11, 2014  Nov 07, 2014
ePub
Page loc. 2274
example code "def document_it(func):"

In the code for "document_it(func)" , and also in the code for "square_it(func)" later on in the same section, the lines: def new_function(*args, kwargs): result = func(*args, kwargs) should have double asterisks in front of "kwargs", like this: def new_function(*args, **kwargs): result = func(*args, **kwargs)

Note from the Author or Editor:
Fixed in QC2. We lost those asterisks in formatting somewhere. Thanks! I would have hated to see that in print.

robert montante  Oct 18, 2014  Nov 07, 2014
PDF
Page 5
4d paragraph

The follwing code-snippet: import requests url = "https://gdata.youtube.com/feeds/api/standardfeeds/top_rated?alt=json" response = requests.get(url) data = response.json for video in data['feed']['entry'][0:6]: print(video['title']['$t']) Returns: Traceback (most recent call last): File "ex2.py", line 5, in <module> for video in data['feed']['entry'][0:6]: TypeError: 'method' object is not subscriptable I used python3.2 on Debian 7.4 to run the code which I previously saved in ex2.py, The module requests was installed.

Note from the Author or Editor:
Fixed. Lost the () in cut & paste.

Anonymous  Mar 06, 2014  Nov 07, 2014
PDF
Page 23
United States

the line : first, 3 * 4 is 12, and 2 * 12 is 14. In Python, as in most languages, multiplication has 2 * 12 is 14 - should be 2 + 12 is 14

Note from the Author or Editor:
Drat. The first one confirmed.

Mike LeRoy  Dec 04, 2014  Feb 20, 2015
PDF
Page 29
United States

>>> print(poem2) I do not like thee, Doctor Fell. The reason why, I cannot tell. But this I know, and know full well: I do not like thee, Doctor Fell. >>> The words "not", "and" & "not" are in black when the rest is blue. When I run this using Ipython there is no indent. A little further down the page the response is in red and blue with "and" & "not" in black

Note from the Author or Editor:
This is an artifact of the PDF production process. The poem text was treated as code, and "not" and "and" are reserved words in Python.

Mike LeRoy  Dec 04, 2014  Feb 20, 2015
PDF
Page 30
just after subtitle "Combine With +"

page 30 (Chapter 2 "Combine with +") the first line reads: a = ' it should read: a = '' otherwise the interactive interpreter will return an error after the line. This actually is minor typo except that it would return the error. Good luck. Introducing Python early release revision 2 ISBN: 978-1-449-35936-2

Note from the Author or Editor:
Fixed at some point.

Donald Altman  Apr 13, 2014  Nov 07, 2014
PDF
Page 32, 33
see below

letters[::7} is 'ahov' and not 'ahpq' letters[4:20:3] is 'ehknqt' and not 'ehloru' letters[19:4] is 'tx' and not 'uy' letters[:21:5] is 'afkpu' and not 'aflqv'

Note from the Author or Editor:
Those have been fixed in Atlas. I don't know when an update will be made available.

Anonymous  Mar 13, 2014  Nov 07, 2014
PDF
Page 33
3rd paragraph from end

Using a plain : is the same as 0:-1 (the entire string): letters[:] 'abcdefghijklmnopqrstuvwxyz' If I use letters[0:-1] it is not the same as letters[:]. It returns 'a-y', while letters[:] returns 'a-z'.

Anonymous  Dec 29, 2014  Feb 20, 2015
Printed
Page 38
bottom

replace() replaces all instances, if count is missing.

dan  Dec 20, 2014  Feb 20, 2015
PDF
Page 45
Tip icon text

Description reverses LIFO and FIFO process. Pop(0) should give FIFO; pop() gives LIFO.

Note from the Author or Editor:
Fixed in ms. Thanks!

Anonymous  May 21, 2014  Nov 07, 2014
ePub
Page 45
Get items by offset range with a slice

The example marxes[::2] is shown to display ['Grouch', 'Harpo'] as the value returned. If the user has been following along withthe examples, ['Groucho', 'Wanda'] will be returned. In a previous example Wanda was substituted for Harpo.

Note from the Author or Editor:
Thanks for catching this.I've notified production to add the line to define the marxes list first.

Nick  Sep 19, 2014  Nov 07, 2014
ePub
Page 48/49

Test for a key with inIf you want to know whether a key exists in a dictionary, use in. Let�s redefine the pythons dict again, omitting a name or two, chen checking to... Chen instead of then

Note from the Author or Editor:
Fixed. Thanks!

Scott Le Camp  Mar 11, 2014  Nov 07, 2014
PDF
Page 56
Top: "Are all the characters in the poem either letters or numbers?"

Starting at the tenth line of text: Are all the characters in the poem either letters or numbers? >>> poem.isalnum False Nope, there were some punctuation characters. Should read >>> poem.isalnum() Parenthesis missing in the book.

Nick  Sep 15, 2014  Nov 07, 2014
PDF
Page 87
United States

>>> def echo(anything): ... ... return anything ' ' anything ... >>> gives invalid syntax with in ipython 3 and python 2.7 Should be: return anything + ' ' + anything

Note from the Author or Editor:
You're right, the line should be: return anything + ' ' + anything Looks like we lost the + signs in formatting.

Mike LeRoy  Dec 05, 2014  Feb 20, 2015
PDF
Page 123
2nd paragraph

"As I mention in Chapter 1, everything in Python...is an object." Should say Chapter 2.

Note from the Author or Editor:
You are correct, and we'll fix it. Thanks.

Ben Nathanson  Feb 11, 2015  Feb 20, 2015
ePub
Page 130
Ch.8, "Write a text file with write", roughly page 130 of ePub.

"For some reason, there aren't many limericks about general relativity". There are none, as far as I know. This limerick refers to SPECIAL relativity. An esoteric point, I know, but, as a physicist, I couldn't let this one pass. And if you ever do find a limerick about general relativity, I'd love to hear it.

Note from the Author or Editor:
That is the best erratum I've ever seen. Thanks! Maybe I can find something about inflation or entanglement?

Martin Ward  Apr 06, 2014  Nov 07, 2014
PDF
Page 131
Table 6-1

This table describes python's testing methods. In the table the last two methods appear to be incorrect. In the document: __lt__(self, other) self <=other __le__(self, other) self >=other It should read: __le__(self, other) self <=other __ge__(self, other) self >=other

Note from the Author or Editor:
Thanks for catching this.

Jerald Jackson  Apr 01, 2014  Nov 07, 2014
PDF
Page 140
First Paragraph(Code Snippet)

class Word(): ... def __init__(self, text): ... self.text = text ... def __eq__(self, word2): ... return self.text.lower() == word2.text.lower() ... def __str__(self): ... return self.text ... def __repr__(self): ... return 'Word("' self.text '")' In this code snippet, __repr__ shoul return "Word('" + self.text + "')", not 'Word("' self.text '")' . This code snippet doesn't do what author wants, and doesn't even work when we enter.

Note from the Author or Editor:
Confirmed formatting error, it does need the + between the strings after 'return'.

Anonymous  May 02, 2015 
Printed
Page 140
Definition of about(self) method of Duck class

The implementation of about(self) uses the global names 'bill' and 'tail', not instance variables. As written: def about(self): print('This duck has a', bill.description, 'bill and a', tail.length, 'tail') Should be: def about(self): print('This duck has a', self.bill.description, 'bill and a', self.tail.length, 'tail') Problems that will be encountered using published code: >>> tail = Tail('long') >>> bill = Bill('wide orange') >>> duck = Duck(bill, tail) >>> duck >>> duck.about() This duck has a wide orange bill and a long tail >>> duck2 = Duck(Bill('narrow green'), Tail('short')) >>> duck2.about() This duck has a wide orange bill and a long tail >>> bill = Bill('purple') >>> duck.about() This duck has a purple bill and a long tail >>> duck2.about() This duck has a purple bill and a long tail >>> del(bill) >>> duck.about() Traceback (most recent call last): File "<pyshell#237>", line 1, in <module> duck.about() File "<pyshell#221>", line 6, in about print('This duck has a', bill.description, 'bill and a', NameError: name 'bill' is not defined

Note from the Author or Editor:
Thanks for catching this. You are completely correct, and your example code proves it. I regret the error. I would blame my cat, but this one wasn't his fault.

Jeff Bienstadt  Aug 05, 2015 
ePub
Page 150
Things to do 7.14

The book says that the pixel width and height of a GIF are encoded as 16-bit big-endian integers, whereas the GIF specification (and indeed the encoded GIF snippet in the book) suggest they are little-endian 16-bit integers. This makes this "thing to do" quite confusing, as it left me wondering what I did wrong!

Note from the Author or Editor:
You're correct. Example 7-14 needs to say that the pixel width is a 16-bit little-endian integer. The example solution in Appendix E uses the correct little-endian specifier (<HH), but repeats the wrong information in the question.

Stefan Zwanenburg  May 16, 2015 
PDF
Page 153
top

The Pattern Matches table at the top of page 153 shows the following: prev+? one or more prev, as few as possible prev+? one or more prev, as many as possible The table actually starts on the previous page (152) where both of the above possibilities are noted. Not to mention that the second is incorrect, I believe. It should read "prev+ one or more prev, as many as possible".

Note from the Author or Editor:
You're right, I had duplicated those two lines. Thanks.

Jerald Jackson  Apr 01, 2014  Nov 07, 2014
PDF
Page 170
United States

Question 7.3 decode pop1 should be pop_bytes

Note from the Author or Editor:
You are right, it's referring to pop_bytes from the previous question. Or at least, it was supposed to.

Mike LeRoy  Dec 12, 2014  Feb 20, 2015
Printed
Page 175
Last line on page

Extraneous ']' (closing square bracket) on call to open() Printed code: >>> try: ... fout = open('relativity', 'xt')] Should be: >>> try: ... fout = open('relativity', 'xt')

Note from the Author or Editor:
Yes, that final right bracket is a formatting error.

Jeff Bienstadt  Aug 10, 2015 
ePub
Page 222
Roughly 1 page after section title "RPCs"; then end of OpenStack section.

Section on RPCs, ePub page 222. "The function we'll providing on the server..." should be "The function we'll be providing on the server..." Just after OpenStack section, page 229. "Things to to" should be "Things to do".

Note from the Author or Editor:
Fixed both of them. Thanks.

Martin Ward  Apr 06, 2014  Nov 07, 2014
Printed
Page 229
second code block

in the echo function we are returning 'thing' but which will print just the text we use in the url. Further down the page the statement is made that we should see the full 'Say hello to my little friend: ' string but we don't because it is not included in the echo function.

Note from the Author or Editor:
Yes, /echo should just output Godzilla. Looks like I pasted output from the upcining template example.

Micheal Beatty  Dec 27, 2014  Feb 20, 2015
PDF
Page 232
United States

from flask import Flask, render_template needs to be from flask import Flask, render_template, request

Note from the Author or Editor:
Yes, it should have the same imports as the example on the previous page.

Mike LeRoy  Jan 05, 2015  Feb 20, 2015
PDF
Page 265
Second code example, showing a queue

In def dryer(dish_queue) function, `while True` is indented 2 times. It should be indented only once. So as it is now, it should be moved four spaces to the left.

Note from the Author or Editor:
Yep, that's a formatting error. I'll check the corresponding github code.

Anton Antonov  Nov 28, 2014  Feb 20, 2015
PDF
Page 315
in just_do_it def

missing "#" in front of Capitalize

Note from the Author or Editor:
Also on page 317 of the print edition.

Mike LeRoy  Jan 29, 2015  Feb 20, 2015