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.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
Printed |
Page N/A
N/A |
Note from the author:
I keep a separate errata list, which may or may
not intersect with the list kept here over time.
Please see the following web page for my errata
and updates lists:
http://www.rmi.net/~lutz/pyref4e-updates.html
Thanks,
--Mark Lutz
|
Mark Lutz |
Oct 28, 2009 |
|
Printed |
Page 11
first para |
"Comparison operators may be chained: X < Y < Z produces the same result as X < Y and Y < X, but Y is evaluated only once in the chained form."
I think the second statement should be "X < Y and Y < Z"
Note from the Author or Editor: A true typo.
|
David McCormick |
Dec 18, 2010 |
Apr 01, 2011 |
Printed |
Page 27
istitle method |
istitle method is missing right parenthesis
Note from the Author or Editor: Yes -- a minor typo, but worth patching in reprints.
|
Steve Chapel |
Jun 25, 2010 |
Aug 01, 2010 |
Printed |
Page 38
very end of the 2nd paragraph under "List comprehension expressions" |
[Oct-31-09] Page 38, list comprehensions: 3.X loop variable scope
This page states that names bound inside a list comprehension are created in the scope containing the comprehension. True, but as clearly stated ahead on page 40, 3.X changes this to work like generator expressions, such that the loop variables are not accessible outside list comprehensions either.
To clarify, at the very end of the 2nd paragraph under "List comprehension expressions", change "where the comprehension resides." to "where the comprehension resides in 2.X (but local to the expression in 3.X).".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Aug 01, 2010 |
Printed |
Page 43
the list term near mid page |
[Nov-06-09] Page 43, adict.fromkeys() usually called on dict itself
This isn't a bug because fromkeys() may be called both on an actual dict instance ({}.fromkeys('abc')) or on the type name dict itself (dict.fromkeys('abc')), but the latter form is the far more typical usage.
To clarify, in the list term near mid page that reads "adict.fromkeys(seq [, value])", change "adict" to "dict". Also, at the end of this list entry's description, add the following text in parenthesis: "...set to value (callable on instance or type name).".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Apr 01, 2011 |
Printed |
Page 46
under infile.read() |
[Oct-28-09] Page 46, infile.read() end-lines: default only
This section states that text mode files translate line-ends to '\n'. This is true, but only by default in Python 3.X; see the open() call on page 113 for its "newline" argument that can modify this.
To clarify, under infile.read(), change "line ends are translated to '\n'." to "line ends are translated to '\n' by default.".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Aug 01, 2010 |
Printed |
Page 47
under outfile.write() |
[Oct-28-09] Page 47, outfile.write() end-lines: default only
This section states that text mode files translate '\n' to the platform's line-end separator. This is true, but only by default in Python 3.X; see the open() call on page 113 for its "newline" argument that can modify this.
To clarify, under outfile.write(), change "line-end marker sequence." to "line-end marker sequence by default.".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Aug 01, 2010 |
Printed |
Page 48
N/A |
Nov-06-09] Page 48, additional file attributes
[No reprint fix required -- clarification only]
This page lists 3 common file object data attributes: closed, mode, and name. It's not intended to be complete, and there are many additional file attributes, the set of which varies widely between Python 2.X and 3.X. For the fiull story, consult Python manuals or run a dir(F) call on any open file object F.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
|
Printed, PDF, , Other Digital Version |
Page 50
second code line on page |
I'm reposting this errata to be fixed in the next reprint. As shown in this book's confirmed errata page, it was originally posted in June 2010 both here and on my own book page. It was marked here as corrected in a reprint in August 2010, but it was never actually fixed -- this typo is still present in the most recent printing I've seen, dated June 2011. Here is the original post from June 2010:
----
The book shows that the result of set('eggs') is the four-item set with values { 's', 'p', 'a', 'm' }
Note from the Author or Editor:
Yes - a genuine typo (no idea where it came from). In the next reprint, please change the list header line on this page that reads:
aset = set('eggs')
to:
aset = set('spam')
|
Mark Lutz |
Nov 17, 2011 |
Mar 09, 2012 |
Printed |
Page 50
text of first list item on page (under heading "set()") |
[Jan-13-09] Page 50, first list item, "empty dictionary" should be "empty set".
In the first list item on this page, under list heading "set()", the indented text "An empty dictionary" should be changed to "An empty set". This is stated clearly in the paragraph immediately preceding this, so it's a minor typo, but incorrect nonetheless.
(It's not completely clear where this came from, though the fact that it reads the same as the dictionary coverage on page 42 strongly suggests a cut-and-paste gone awry, and the author who wrote it in the midst of a 2000-mile cross-country move is considered to be a "person of interest"...).
----
copied from http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Jan 13, 2010 |
Aug 01, 2010 |
Printed |
Page 50
2nd set example |
The book shows that the result of set('eggs') is the four-item set with values { 's', 'p', 'a', 'm' }
Note from the Author or Editor: Yes - a genuine typo (no idea where it came from). In the next reprint, please change the list header line on this page that reads:
aset = set('eggs')
to:
aset = set('spam')
|
Steve Chapel |
Jun 09, 2010 |
Aug 01, 2010 |
, Printed, PDF, ePub, Mobi, , Other Digital Version |
Page 51
set1 >= set2 |
set1 >= set2, set1.issubset(other) should read:
set1 >= set2, set1.issuperset(set2)
Note from the Author or Editor: Yes, but half right: this should really be:
"set1 >= set2, set1.issuperset(other)"
because "other" is used to imply a possibly non-set object, as described just before this text.
|
Steve Chapel |
Jul 09, 2013 |
|
Printed |
Page 64 & 73
just before the "def name..." format listing on page 64, and just before the "class name..." format listing on page 73 |
Nov-14-09] Page 64 and 73, add "[decoration]" to def and class syntax formats
The book covers function and class decorators on pages 67 and 74. Because they are tied to def and class statements syntactically, though, and because it looks like we have the room, I want to make this more explicit by adding a line that reads "[decoration]" just before the "def name..." format listing on page 64, and just before the "class name..." format listing on page 73.
In other words, these two code format layouts on these pages should look like (note that the indentation whitespace will be stripped in this code by this site -- please consult the original of this posting on my websit listed below for a more accurate description):
The def Statement
[decoration]
def name([arg,... arg=value,... *arg, **arg]):
suite
The class Statement
[decoration]
class name [ ( super [, super]* [, metaclass=M] ) ]:
suite
The two added lines should be fixed-with font, and their "decoration" should be italics/replaceable.
This is all fairly obvious in the decorator descriptions that follow these, and the syntax formats are not intended to be complete (they also don't include 3.X keyword-only arguments and function annotations, which are similarly described a few pages ahead). Still, given that decorators work in both 2.6 and 3.X and are used widely today, it would nice to include them in the syntax formats.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Apr 01, 2011 |
Printed |
Page 74
bullet 4 |
[Nov-13-09] Page 74, bullet 4, describes instance method default only
Strictly speaking, this bullet describes the instance method model, which is the normal case for methods in a class (self recieves the instance). Keep in mind, though, that this is just the default; Python also has static methods (which receive no instance) and class methods (which receive a class in self). Moreover, Python 3.X class methods may be called as simple functions through a class with no instance at all, and need be declared static only if they are called through an instance.
This is not an errata, because the description is correct for the normal case, and this brief summary isn't intended to be a complete coverage of all method variants. The built-in functions section covers staticmethod() and classmethod(), and the book Learning Python presents the full story on all method types.
To clarify slightly, though, at the end of the 4th bullet on this page, add this: "The staticmethod() and classmethod() built-ins support additional kinds of methods, and Python 3.X methods may be treated as simple functions when called through a class." In this, "staticmethod()" and "classmethod()" are literals in fixed-width font. If this does not fit, delete the ", etc." at the end of bullet 2 to free up a line.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Apr 01, 2011 |
Printed |
Page 89
line 2 |
[Nov-14-09] Page 89 minor wording typo in line 2
There's a bogus "as" in this line: change "with the same as constructor arguments" to "with the same constructor arguments".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Aug 01, 2010 |
Printed, PDF, , Other Digital Version |
Page 92
line 2 of 4th paragraph |
I'm reposting this errata to be fixed in the next reprint. As shown in this book's confirmed errata page, it was originally posted in November 2009 both here and on my own book page. It was marked here as corrected in a reprint in August 2010, but it was never actually fixed -- this typo is still present in the most recent printing I've seen, dated June 2011. (A batch of 6 fixes did show up in the August 2010 reprint, so it looks like this and the other I reposted on Page 50 just fell through the cracks). Here is the original post from June 2010:
----
[Nov-13-09] Page 92 minor wording typo in line 2 of 4th paragraph
There are two typos in one sentence here. In this paragraph, change "list attribute or access then" to "list attributes or access them".
|
Mark Lutz |
Nov 17, 2011 |
Mar 09, 2012 |
Printed |
Page 92
line 2 of 4th paragraph |
Nov-13-09] Page 92 minor wording typo in line 2 of 4th paragraph
There are two typos in one sentence here. In this paragraph, change "list attribute or access then" to "list attributes or access them".
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Aug 01, 2010 |
Printed |
Page 110, etc
various |
Nov-11-09] Page 110 (and a few more): literal word split over line break
In the second-last paragraph of this page, the literal word "iterator" is split across a line break badly, as "itera|tor". This occurs in four other places as well: pages 47 (string literal 'a\0b|\0c'); 120 ("memory|view"); 126 ("Base|Exception"); and 145 ("os.envi|ron"). Not a major issue, but all these terms should appear on a single line and not be split (or should at least be hyphenated if split, though this isn't ideal for literals).
This is a result of O'Reilly's formatting process and I asked that these all be fixed during production. Most were, but a handful seem to have slipped through the cracks (alas, deadlines are the Mother of many an errata...)
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Mar 09, 2012 |
Printed |
Page 111
the start of the first paragraph under open(...) |
[Oct-28-09] Page 111, 3.X open(), add link to 2.X version
Page 111 begins documenting the 3.X open() call. Although it's implied by the book's contents, it would nice to note the location of the corresponding 2.X open() description, given the prevalence of this call. At the start of the first paragraph under open(...), add "See also Python 2.X open() on page 123."
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Jun 24, 2011 |
Printed |
Page 113
the middle of the 4th last line on page 113 |
Nov-28-09] Page 113, print() default end='\n', not 'n' (minor typo)
The call format given by the print() function's list header is missing a backslash. In the middle of the 4th last line on page 113, change: "[, end='n']" to "[, end='\n']".
This is present in the initial draft, so it's my bad. Apparently, the call format was copied from the Python 3.0 library manual entry for print(), which contains the same typo. The Python 3.1 library manual added the required backslash, but this wasn't caught in the book. The book does get the '\n' default correct in its more complete coverage of print() on page 60.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Apr 01, 2011 |
Printed, PDF, |
Page 118
last paragraph |
(Correction added for inclusion in reprints from
http://www.rmi.net/~lutz/pyref4e-updates.html)
------
[Jul-8-10] Page 118, last paragraph: zip now allows no arguments; bogus "]" in text
Two fixes in the zip description in the last paragraph on this page. First, delete the bogus "]" character at the end of 'd')] at the start of line 4. Second, change the entire sentence immediately following this from "At least one iterable is required, or a TypeError is raised." to read "At least one iterable is required, or the result is empty."
|
Mark Lutz |
Jul 12, 2010 |
Apr 01, 2011 |
Printed, PDF, |
Page 148
very end of the listdir description (paragraph 1 on this page) |
(Correction added for inclusion in reprints from
http://www.rmi.net/~lutz/pyref4e-updates.html)
------
[Jul-8-10] Page 148, os.listdir: pass bytes to suppress Unicode filename decode
At the very end of the listdir description (paragraph 1 on this page), if we have space, add the sentence: "In 3.X, passed and returns bytes instead of str to suppress Unicode filename decoding per platform default (also for glob, os.walk)."
This is a crucial point, as it's required to avoid exceptions for any undecodable filenames in 3.X. If we don't have space to add anything here, this note is clarification only; it's described in depth in Programming Python 4th Edition.
|
Mark Lutz |
Jul 12, 2010 |
Jun 24, 2011 |
Printed, PDF, ePub |
Page 161
column 2 of row 2 (the '\' row) |
The notation used to illustrate escapes is a bit off. In column 1 of row 2 (the '\' row), change the r'\\' at the very end to r'..\..'.
As is, the r'\\' per raw-string semantics really means 2 slashes which is not right, but a r'\' doesn't work either as these strings can't end in an odd number of slashes. The new r'..\..' is meant to denote a slash taken either as itself or before an escaped character that's meaningful in Python string syntax.
|
Mark Lutz |
Oct 18, 2014 |
|
Printed |
Page 165
second last line on this page |
[Nov-06-09] Page 165, dbm/shelve "has_key()" becomes "in" in 3.X
Change the second last line on this page from "found = file.has_key('key')" to "found = 'key' in file (or has_key() in 2.X only)"
As explained in the earlier sections on mapping operations and dictionaries (see pages 14, 41, and 43-44), the 2.X dict.has_key() method is replaced by the "in" membership operator in 3.X (though both work in 2.X). This holds true for the dictionary-like dbm and shelve file interfaces as well, and this minor mention apparently was overlooked.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Apr 01, 2011 |
Printed |
Page 173
Commonly Used Library Modules |
The "random" module is commonly used but is not listed in the commonly used library modules section.
Note from the Author or Editor: Thanks for the suggestion, but this short reference cannot cover all interesting Python modules and retain its physical size. This module will, however, be added to a list of potential additions (along with timeit and others) for a later edition, if one ever materializes. Also changed this post's type to "question/clarification", from "minor technical mistake" (it's hardly the latter).
|
Steve Chapel |
Aug 22, 2011 |
|
Printed |
Page 192
index entry for "functions, 64" |
[Nov-06-09] Index, page 192, link to "def" at "functions"
In the index at "functions, 64", add "(see also def statements)". As is, most function details are indexed under "def", not "functions", but "functions" is the first place most readers will probably look.
--------
This entry was copied from the complete updates page for
this book, which may contain additional information:
http://www.rmi.net/~lutz/pyref4e-updates.html
|
Mark Lutz |
Nov 30, 2009 |
Jun 24, 2011 |
Printed |
Page 200
last page - Safari ad |
Please remove the book-specific Safari ad on the last page and replace it with the generic ad.
|
Nellie McKesson |
Mar 22, 2012 |
|