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 21
|
The Meaning of the -tt option reads:
"Like -tt, but raises an error rather than a warning"
now reads:
"Like -t, but raises an error rather than a warning"
p. 45 --
"from future import division"
now reads:
"from __future__ import division"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 47
Pargraph "Slicing a sequence", lines 4-5 |
"j is less than i"
now reads:
"j is less than or equal to i"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 48
Modifying a list, 2nd bulleted item |
L[i:i]=['a','b'] inserts the items 'a' and 'b' after item i in L.
now reads:
L[i:i]=['a','b'] inserts the items 'a' and 'b' before item i in L.
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 48
Last paragraph |
The last sentence ends with
"..., while L*=n has the effect of adding n copies of L to the end of L."
The last sentence now reads:
"..., while L *= n has the effect of adding n-1 copies of L to the end of L."
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 48
"Modifying a list", first code fragment |
x[1] = 42 # x is now [1,42,2,3]
Now reads:
x[1] = 42 # x is now [1,42,3,4]
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 52
IN PRINT: "The if Statement", syntax listing |
"else expression:
statement(s)"
Now reads:
"else:
statement(s)"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 65
last code listing |
def percent2(a, b, c): #needs 2.2 or "from future import"
Now reads:
def percent2(a, b, c): #needs 2.2 or "from __future__ import"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 66
2nd code listing |
def make_adder_2(augend): # needs 2.2 or "from future import"
Now reads:
def make_adder_2(augend): # needs 2.2 or "from __future__ import"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 76
middle of page |
print x.e, x.d, x.c, x.b. x.a
NOW READS:
print x.e, x.d, x.c, x.b, x.a
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 78
2nd paragraph, first sentence |
Missing "to" in "A bound method is similar TO an unbound method,..." has now been added.
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 85 & 86
code examples |
The code samples use the variable "heigth", which is now correctly spelled as "height".
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 86
middle of the page |
The code:
class OptimizedRectangle(object):
__slots__ = 'width', 'height'
__slots__ cannot usefully be added by inheritance in this way; so the
example should be rewritten to avoid inheritance and rather just copy
the whole Rectangle class as given at the top of page 85 under the new
name OptimizedRectangle:
class OptimizedRectangle(object):
__slots__ = 'width', 'height'
def __init__(self, width, height):
self.width = width
self.height = height
def getArea(self):
return self.width * self.height
area = property(getArea, doc="area of the rectangle")
|
Anonymous |
|
|
Printed |
Page 100
IN PRINT: Single line of code near bottom of page |
"__metaclass_ = type"
Now reads:
"__metaclass__ = type"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 100
Last sentence, 5th paragraph |
"Since type(object) is type, a class C that inherits from object (or some other built-
in type) gets the same metaclass as object (i.e., type(C), C's metaclass, is also
type) Thus, being a new-style class is synonymous with having type as the metaclass."
"Thus, being..." is the start of a second sentence. A period HAS BEEN ADDED to the end of the sentence
"Since type(object)...".
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 112
IN PRINT: First code sample, second line |
"except InvalidAttribute, err"
Now reads:
"except InvalidAttribute, err:"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 130
buffer() function |
where it says:
For more on buffer, see Chapter 13.
The text now reads:
The buffer built-in is now deprecated.
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 163
IN PRINT: Code listing near top of page, third line |
"if re.search(..."
Now reads:
"if digatend.search(..."
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 163
Bottom |
The bottom line of text was missing in printings after 9/03.
the missing line was:
want to print only words that are followed by whitespace (not
THIS HAS BEEN CORRECTED.
|
Anonymous |
|
Aug 01, 2005 |
Printed |
Page 164
Description of "map - last paragraph |
The last Paragraph of the description of map states:-
"When func is None, map returns a list of tuples ..."
This is only true if map is given at least 2 seqs to "map".
If it is given a single seq, it returns the seq itself.
This can cause serious errors in programs that expect
tuples to be returned.
Note from the Author or Editor: p. 164 under `map`, 2nd paragraph, change the text that now reads
When func is None, map returns a list of tuples, each with n items (one item from each iterable); this is
to read
When func is None, map returns a list of tuples, each with n items (one item from each iterable) when n>1; this is
and add to the same paragraph (which now ends "the longer ones.") a further sentence
When func is None and n is 1, map returns a list of the items of seq (while zip would return a list of tuples with just one item each).
|
Ross Cartlidge |
Jan 29, 2009 |
|
Printed |
Page 177
Last paragraph |
The os.path Module functions table is missing the "expanduser" method
and related description. (See, for example, the documentation at the
following URL: http://python.org/doc/2.2.3/lib/module-os.path.html)
|
Anonymous |
|
|
Printed |
Page 177
dirname |
"For example, os.path.basename('b/c/d.e') returns 'b/c'"
Now reads:
"For examples, os.path.dirname('b/c/d.e') returns 'b/c'"
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 185
third line from the bottom; the description of lseek |
"but calling lstat on a file that does not support seeking ..."
should be:
"but calling lseek on a file that does not support seeking ..."
|
Anonymous |
|
|
Printed |
Page 202
Example code, data_to_zip_direct |
To make the example work the same way for both the direct and indirect method, the line:
zinfo.compress_type = zipfile.ZIP_DEFLATED
HAS BEEN ADDED after the line:
zinfo = zipfile.ZipInfo(name, time.localtime()[:6])
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 221
1st paragraph of description of the translation() function,2nd/3rd sentences |
When languages is None, translation looks in the environment for the lang to use, like install.
However, languages can also be a list of one or more lang names separated by colons (:), in which
case translation uses the first of these names for which it finds a .mo file.
NOW READS:
When languages is None, translation looks in the environment for the lang to use, like
install: it examines, in order, environment variables LANGUAGE, LC_ALL, LC_MESSAGES, LANG -- the first
non-empty one is split on ':' to give a list of lang names (for example, 'de:en' would be split to give ['de','en']).
When not None, languages must be a list of one or more lang names (for example, ['de','en']). Translation uses the
first lang name in the list for which it finds an .mo file.
|
Anonymous |
|
Aug 01, 2005 |
Printed |
Page 222
11th line |
gettext.translation(domain, languages=lang)
NOW READS:
gettext.translation(domain, languages=[lang])
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 225
|
"in releases of Python older than the ones covered in this book,
unpickling from an untrusted data source was a security risk ... No
such weaknesses are known in Python 2.1 and later."
This is no longer true, the 2nd edition says:
Note that unpickling from an untrusted data source is a security risk; an attacker could
exploit this to execute arbitrary code. Don't unpickle untrusted data!
|
Anonymous |
|
|
Printed |
Page 241
IN PRINT: Connection Objects - cursor method |
x.close()
Now reads:
x.cursor()
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 284
Threading example program at bottom of page |
Classes ExternalInterfacing and Serializer (snippets on pages 284-285)
are not thread-safe as shown in the book. Change the snippets as
follows:
Add the following auxiliary class, to be used in both snippets, and
useful in its own right:
class PoolOfQueues:
# thread-safe, because a list's pop and append methods are atomic
def __init__(self):
self.pool = []
def get_a_queue_from_pool(self):
try: return self.pool.pop()
except IndexError: return Queue.Queue()
def return_a_queue_to_pool(self, q):
self.pool.append(q)
queues=PoolOfQueues()
Change class ExternalInterfacing to:
class ExternalInterfacing(Threading.Thread):
def __init__(self, externalCallable, **kwds):
Threading.Thread.__init__(self, **kwds)
self.setDaemon(1)
self.externalCallable = externalCallable
self.workRequestQueue = Queue.Queue()
self.start()
def request(self, *args, **kwds):
"called by other threads as externalCallable would be"
q = queues.get_a_queue_from_pool()
self.workRequestQueue.put((q, args, kwds))
try: return q.get()
finally: queues.return_a_queue_to_pool(q)
def run(self):
while 1:
q, args, kwds = self.workRequestQueue.get()
q.put(self.externalCallable(*args, **kwds))
Change class Serializer to:
class Serializer(Threading.Thread):
def __init__(self, **kwds):
Threading.Thread.__init__(self, **kwds)
self.setDaemon(1)
self.workRequestQueue = Queue.Queue()
self.start()
def apply(self, callable, *args, **kwds):
"called by other threads as callable would be"
q = queues.get_a_queue_from_pool()
self.workRequestQueue.put((q, callable, args, kwds))
try: return q.get()
finally: queues.return_a_queue_to_pool(q)
def run(self):
while 1:
q, callable, args, kwds = self.workRequestQueue.get()
q.put(callable(*args, **kwds))
|
Anonymous |
|
|
Printed |
Page 284
IN PRINT: code sample, first line |
import Threading, Queue
Now reads:
import threading, Queue
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 285
IN PRINT: code sample in middle of page, first line |
import Threading, Queue
Now reads:
import threading, Queue
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 286
IN PRINT: first code sample, first line |
import Threading
Now reads:
import threading
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 291
bottom |
import os
os.spawnv(os.p_WAIT, editor, [textfile])
NOW READS:
import os
os.spawnv(os.p_WAIT, editor, [editor, textfile])
and, the last sentence NOW READS:
The first item of the argument <replaceable>args</replaceable> is
passed to the program being spawned as "the name under which the
program is being invoked". Most programs don't look at this, so you
can place any string there. Just in case the editor program does look
at this special first argument, passing the same string
<replaceable>editor</replaceable> that is used as the second argument
to os.spawnv is the simplest and most effective approach.
|
Anonymous |
|
Aug 01, 2005 |
Printed |
Page 303
5th paragraph, tofile |
tofile Note that f should be open for reading in binary mode, for example with
mode 'rb'.
now reads:
tofile Note that f should be open for writing in binary mode, for example with
mode 'wb'.
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 307
Code listing, under Slicing Examples |
a[0,2:4)
Now reads:
a[0,2:4]
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 312
5th paragraph |
where it says:
an array with rank of one less than a and of the same size as a
The text now reads:
an array with rank 1 and of the same size as a
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 320
3rd paragraph |
where it says:
just like array(a,copy=False).flat
The text now reads:
just like array(a,copy=(not a.iscontiguous())).flat
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 328
the URL |
http://starbase.neosoft.com/~claird/comp.lang.python/python_GUI.html
The URL has changed and now reads:
http://phaseit.net/claird/comp.lang.python/python_GUI.html
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 335
5th paragraph |
In the example to diplay GIF images in the example, the line:
img.config(image=gifsdict[imgname])
Is now indented as follows:
def list_entry_clicked(*ignore):
imgname = L.get(L.curselection()[0])
img.config(image=gifsdict[imgname])
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 337
2nd paragraph of Entry section |
An Entry instance with state=DISABLED is a good way...
"state=DISABLED" should be replaced by "state='readonly'" for the
remainder of the page.
state=DISABLED doesn't allow you to select an Entry's text
or copy it to the clipboard.
Note from the Author or Editor: p. 416 and 417 *NOT* 337, change all occurrences of DISABLED (I count four) to 'readonly' (lowercase and with single quotes around). So for example
state=DISABLED
must become
state='readonly'
and so on.
|
Anonymous |
|
|
Printed |
Page 337
last table entry |
toggle c.deselect()
Now reads:
toggle c.toggle()
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 342
middle of page |
The entry for 'iconify' shows 'deiconify' for the example.
Iconify T.deiconify()
Now reads:
Iconify T.iconify()
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 346
Under "Menu Example" heading |
The following two lines have been added to the end of the script:
root.config(menu=bar)
Tkinter.mainloop()
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 346
code sample at very bottom |
def makeshow(menu):
def emit(entry, menu=menu): print menu, entry
return emit
NOW READS:
def mkshow(menu, entry):
def emit(): print menu, entry
return emit
AND the first two lines on the top of page 347;
and use command=mkshow('File') and command=mkshow('Edit'),
respectively, in the calls to the add_command methods of fil and edi.
NOW READ:
and use command=mkshow('File', x) and command=mkshow('Edit', x),
respectively, in the calls to the add_command methods of fil and edi.
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 361
in plot function |
logical error
j = CY*(y-miny)/(maxy-miny)
Now reads:
j = CY - CY*(y-miny)/(maxy-miny)
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 383
second code sample |
try: x.f()
except AttributeError:
sys.stderr.write('x is type %s, (%r)
'%(x,type(x)))
That 3rd line NOW READS:
sys.stderr.write('x is type %s, (%r)
'%(type(x), x))
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 421
between mkd and pwd methods |
omitted nlist method.
The nlst method should probably be included, in its normal alphabetical order
(i.e., after mkd but before pwd) with the text (in the usual mixture of fonts
and typefaces like for the other methods):
nlst f.nlst(pathname='.')
Sends a NLST command to the FTP server, asking for the names
of the files in the directory named by pathname (by default,
the current directory), and returns the list of the filenames.
((i.e., as usual, I would omit weird, rarely used stuff such as, in this case,
the optional, non-portable extra arguments)).
|
Anonymous |
|
|
Printed |
Page 430
ServerProxy methods |
"...supplies an attribute s.server that..."
NOW READS:
"...supplies an attribute s.system that..."
s.server.listMethods()
s.server.methodSignature(name)
s.server.methodHelp(name)
NOW READ:
s.system.listMethods()
s.system.methodSignature(name)
s.system.methodHelp(name)
|
Anonymous |
|
Aug 01, 2005 |
Printed |
Page 433
fourth and fifth functions (ntohl and ntohs) |
where it says
ntohl htonl(i32)
The text now reads:
ntohl ntohl(i32)
AND
where it says
ntohs htons(i32)
The text now reads:
ntohs ntohs(i32)
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 441
Example code at bottom of page |
The example trivial HTTP server is missing the two lines to instantiate and start up the server.
After the line do_HEAD = do_POST = do_GET, the following two lines have been added:
server = BaseHTTPServer.HTTPServer(('',80), TrivialHTTPRequestHandler)
server.serve_forever()
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 445
example 19-6; the final lines of code (at the end of the "for x in i: portion of the example") |
try: ous.remove(x)
except ValueError: pass
x.close()
NOW READ:
try: ous.remove(x)
except ValueError: pass
x.close()
ins.remove(x)
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 477
2nd par.: MIMEImage |
MIMEImage class MIMEAudio(_imagedata,...
Now reads:
MIMEImage class MIMEImage(_imagedata,...
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 499
last paragraph |
quoteattr escape(data,entities={})
Now reads:
quoteattr quoteattr(data,entities={})
Pages 507, 508, and 511:
The following warning note has been added on page 511:
The code examples given on pages 507, 508 and 511 may crash under
some version of Python and Windows (not Python 2.3, and not Linux
versions of Python). To fix your version of Python so that it is able to
run the examples, visit URL:
http://sourceforge.net/project/showfiles.php?group_id=6473
and download and run the appropriate self-installing .EXE, for example
currently PyXML-0.8.2.win32-py2.2.exe if you run Python 2.2 on any
version of Microsoft Windows. This self-installing EXE will add to your
Python installation the latest version of the "XML subsystem" of Python,
and, as a side effect, fix any bugs connected to XML handling that may
have been diagnosed after the release of your version of Python.
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 536
Example 24-1 |
There are two arrays declared as
static char merge_docs[]
The second one (page 536) now reads:
static char mergenew_docs[] = "
|
Anonymous |
|
Sep 01, 2003 |
Printed |
Page 567
Manifest section 1st bullet |
sdist default does not include scripts or data files, even if specifically mentioned
in the setup.py script. The default only includes:
"all Python source files implied by the py_modules and packages options"
To include scripts or data files by sdist, you have to create a MANIFEST.in
|
Anonymous |
|
|
Printed |
Page 569
Bottom paragraph |
The Installer website NOW READS:
http://www.mcmillan-inc.com/install1.html
|
Anonymous |
|
Aug 01, 2004 |
Printed |
Page 571
Index of Symbols "*" and "**" |
Index for "*" and "**" should be augmented for
define extra arguments, 60
pass extra arguments, 64
|
Anonymous |
|
|
Printed |
Page 591
bottom right |
There is no entry in the index for the consept "frozen", mentioned on page 121 just
before and after the heading "Searching the Filesystem for a Module".
Worse IMHO, there's no explanation in the book, that I can find, on what "frozen
modules" is. A line or two on page 121 would have been nice.
|
Anonymous |
|
|