Errata

Learning Python

Errata for Learning 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
Printed
Page xviii
4th paragraph

"Learning Python is designed to be naturally complimented by..."

NOW READS:
"Learning Python is designed to be naturally complemented by..."

Anonymous    Mar 01, 2005
Printed
Page xvi
last bullet in first list of bullets

"New testing and documentation tools such as PyDoc, PyUnit, and doctest (Chapter 11)"

NOW READS:
"New testing and documentation tools such as PyDoc, PyUnit, and doctest (Chapter 26)"

Anonymous    Mar 01, 2005
Printed
Page 4
4th paragraph, 2nd sentence

"Although this may be an intangible benefit, it's effect on productivity at large is
an important asset."

"It's" NOW READS "its."

Anonymous    Mar 01, 2005
Printed
Page 10
1st paragraph

"On the web, you'll also find a third-party system called gadfly that
implements a SQL database for Python programs, a complete
object-oriented database system called ZODB."

NOW READS:
"On the web, you'll also find a third-party system called gadfly that implements
a SQL database for Python programs, and a complete
object-oriented database system called ZODB."

Anonymous    Mar 01, 2005
Printed
Page 12
2nd paragraph

"Be-OS". NOW READS "BeOS".

"PocketPC and CE"

NOW READS:
"PocketPC and Windows CE"

Anonymous    Mar 01, 2005
Printed
Page 15
First paragraph, last line

"... Python code will be much less to write, debug, and maintain."

NOW READS:
"... Python code will be much less difficult to write, debug, and maintain."

Anonymous    Mar 01, 2005
Printed
Page 21
3rd paragraph

"Python.net" NOW READS "Python.NET" (as on page 22).

Anonymous    Mar 01, 2005
Printed
Page 29
2nd paragraph

"...type three Python statements into a text file named spam.py".

NOW READS:
"...type two Python statements into a text file named spam.py".

Anonymous    Mar 01, 2005
Printed
Page 30
paragraph 7

"Finally, remember to give the full path to
your script file if it lives a different directory ...."

NOW READS:
"Finally, remember to give the full path to
your script file if it lives in a different directory ...."

Anonymous    Mar 01, 2005
Printed
Page 38
First line on page

.. attribute title in other components two different ways.

NOW READS:
.. attribute title in other components in two different ways.

Anonymous    Mar 01, 2005
Printed
Page 46
line 3

www.python.og NOW READS www.python.org

Anonymous    Mar 01, 2005
Printed
Page 59
"Parentheses Group Subexpressions", line 5 and line 10

On line 5, "write one of the following to force Python evaluate"

NOW READS:
"write one of the following to force Python to evaluate"

On line 10, "In the second cases" NOW READS "In the second case"

Anonymous    Mar 01, 2005
Printed
Page 61
third text paragraph

"that's why the result are displayed ..."

NOW READS:
"that's why the result is displayed ..."

Anonymous    Mar 01, 2005
Printed
Page 64
3rd text paragraph

"In general, any code that depends on / truncating an integer result may be effected..."

NOW READS:
"In general, any code that depends on / truncating an integer result may be affected..."

Anonymous    Mar 01, 2005
Printed
Page 67
6th text paragraph

"This is covered in Chapter 4."

NOW READS:
"This is covered in Chapter 5."

Anonymous    Mar 01, 2005
Printed
Page 71
last line

"... the first item in the list L."

NOW READS:
"... the first item in the list L1."

Anonymous    Nov 01, 2004
Printed
Page 72
1st paragraph under "References and Garbage Collection"

"...Python also reclaims the old object, if it is not reference by any other name (or object)."

NOW READS:
"...Python also reclaims the old object, if it is not referenced by any other name (or object)."

Anonymous    Mar 01, 2005
Printed
Page 75
Table 5-1 (continued), line 5 from bottom

"S2.find('pa')"

NOW READS:
"s2.find('pa')"

Anonymous    Nov 01, 2004
Printed
Page 80
4th paragraph, last line

"Unicode is normlly used to ..."

NOW READS:
"Unicode is normally used to ..."

Anonymous    Mar 01, 2005
Printed
Page 81
2nd line after code

"hexidecimal"

NOW READS:
"hexadecimal"

Anonymous    Mar 01, 2005
Printed
Page 82
code after first paragraph; In third comment,

Repitition NOW READS Repetition.

Anonymous    Mar 01, 2005
Printed
Page 83
4th paragraph

"The first line defines a four-character string and assign it the name S."

NOW READS:
"The first line defines a four-character string and assigns it the name S."

Anonymous    Mar 01, 2005
Printed
Page 84
2nd line

"When you index a sequence object such as a string on a pair of offsets seperated by a colon..."

NOW READS:
"When you index a sequence object such as a string on a pair of offsets separated by a colon..."

Anonymous    Mar 01, 2005
Printed
Page 87
No.2 under String Formatting

objects in parenthesis
->
objects in parentheses

########################################

Anonymous    Mar 01, 2007
Printed
Page 88
"Advanced String Formatting", line 1

"... you can use any of conversion codes ...."

NOW READS:
"... you can use any of the conversion codes ...."

Anonymous    Mar 01, 2005
Printed
Page 88
5th line from bottom

%X X, but prints uppercase

NOW READS:
%X x, but prints uppercase

Anonymous    Mar 01, 2005
Printed
Page 90
3rd text paragraph

"See also the section "Numbers" in Chapter 4 for examples that convert to
hexidecimal and octal strings with the %x and %o formatting target codes."

NOW READS:
"See also the section "Numbers" in Chapter 4 for examples that convert to
hexadecimal and octal strings with the %x and %o formatting target codes."

Anonymous    Mar 01, 2005
Printed
Page 94
Last line of first paragraph

'basic text extraction cores.'

NOW READS:
'basic text extraction chores.'

Anonymous    Mar 01, 2005
Printed
Page 98
Table 6-1, the column2 entries

"""
Index,
slice,
length
"""

NOW READS:

"""
Index,
index of index,
slice,
length
"""

Anonymous    Mar 01, 2005
Printed
Page 99
1st Paragraph, 2nd sentence

For instance, the second row in Table 6-1 assigns variable L1 to a four-item list.

NOW READS:
For instance, the second row in Table 6-1 assigns variable L2 to a four-item list.

page 105, Table 6-2,
d3['food']['ham']

NOW READS:
D3['food']['ham']

AND

len(d1)

NOW READS:
len(D1)

AND

del d2[key]

NOW READS:
del D2[key]

Anonymous    Mar 01, 2005
Printed
Page 106
First set of examples

>>> 'ham' in d3

NOW READS:
>>> 'ham' in d2

Anonymous    Mar 01, 2005
Printed
Page 107
4th paragraph,end of 2nd line

"blindly overwiting values"

NOW READS:
"blindly overwriting values"

Anonymous    Mar 01, 2005
Printed
Page 109
+5

empty except for the two positions, (2,3,4) and (7,8,8).
->
empty except for the two positions, (2,3,4) and (7,8,9).

########################################

Anonymous    Sep 01, 2006
Printed
Page 111
2nd paragraph

dict([('name,'bob'), ('age',30)])

NOW READS:
dict([('name','bob'), ('age',30)])

Anonymous    Nov 01, 2004
Printed
Page 113
Table 7-1, the column2 entries

"""
Index,
slice,
length
"""

NOW READS:

"""
Index,
index of index,
slice,
length
"""

Anonymous    Mar 01, 2005
Printed
Page 114
2nd paragraph

"Many programmers also find that parenthesis tend to aid script readability."

NOW READS:
"Many programmers also find that parentheses tend to aid script readability."

Anonymous    Mar 01, 2005
Printed
Page 120
Last (fourth) code section, second line

Emded copies of X's object.
Should be:
Embed copies of X's object.

########################################

Anonymous    Jun 01, 2007
Printed
Page 125
4th paragraph,in the second sentence

"exmaple"

NOW READS:
"example".

Anonymous    Mar 01, 2005
Printed
Page 137
Table 8-3

In the list of Python reserved words, the keyword 'Is' NOW READS 'is'
and the keyword 'lamda' NOW READS 'lambda'

Anonymous    Mar 01, 2005
Printed
Page 137
footnote

"In the Jython Java-based implementation or Python, ..."

NOW READS:
"In the Jython Java-based implementation of Python, ..."

Anonymous    Mar 01, 2005
Printed
Page 144
middle of sidebar

sys.sytdout
->
sys.stdout

########################################

Anonymous    Sep 01, 2006
Printed
Page 154
2nd paragraph

"true of false"

NOW READS:
"true or false"

Anonymous    Mar 01, 2005
Printed
Page 156
"Examples" section; first line

"here are a few of simple...."

NOW READS:
"here are a few simple.

Anonymous    Mar 01, 2005
Printed
Page 164
"Loop Variations" section; paragraph 2; bullet 2

"... returns a list a ...."

NOW READS:
"... returns a list of ..."

Anonymous    Mar 01, 2005
Printed
Page 165
Third "#" comment line in the code examples

Read byte chucks
->
Read byte chunks

########################################

Anonymous    Mar 01, 2007
Printed
Page 169
end of 4th paragraph

Reference to "Chapter 11" NOW READS "Chapter 14"

Anonymous    Mar 01, 2005
Printed
Page 172
1st block of code

"ommitted"

NOW READS:
"omitted"

Anonymous    Aug 01, 2005
Printed
Page 172
3rd line of the "The dir Function" section

atributes
->
attributes

########################################

Anonymous    Sep 01, 2006
Printed
Page 173
first paragraph under Docstrings:__doc__, last line

...known as a docsting, into the __doc__ attribute...

NOW READS:
...known as a docstring, into the __doc__ attribute...

Anonymous    Mar 01, 2005
Printed
Page 173
1st block of code

"ommitted"

NOW READS:
"omitted"

Anonymous    Aug 01, 2005
Printed
Page 175
"Built-in docstrings" section; line 1

"It turns out that built modules ...."

NOW READS:
"It turns out that built-in modules ..."

Anonymous    Mar 01, 2005
Printed
Page 175-177
(in examples)

"ommitted"

NOW READS:
"omitted"

Anonymous    Aug 01, 2005
Printed
Page 182
2nd paragraph

relevent

NOW READS:
relevant

Anonymous    Mar 01, 2005
Printed
Page 194
3rd paragraph

categoy

NOW READS:
category

Anonymous    Mar 01, 2005
Printed
Page 206
mid page, on the right side

"in most cases, it is no longer necesary..."

NOW READS:
"in most cases, it is no longer necessary..."

Anonymous    Mar 01, 2005
Printed
Page 214
in function min1

if arg < args:

NOW READS:
if arg < res:

Anonymous    Nov 01, 2004
Printed
Page 214
3rd bullet note

"The third converts from tuple to list with the built-in tuple call, ..."

NOW READS:
"The third converts from tuple to list with the built-in list call, ..."

Anonymous    Nov 01, 2004
Printed
Page 215
Line 4, first line of output from running mins.py

The result of the statement
print min1(3,4,1,2)

from the previous page NOW READS "1" instead of "2"

Anonymous    Mar 01, 2005
Printed
Page 229
2nd line from top of page

'passsed' NOW READS 'passed'

Anonymous    Aug 01, 2005
Printed
Page 250
penultimate line

"HTLM" NOW READS "HTML"

Anonymous    Aug 01, 2005
Printed
Page 261
+1


To really change a global name in another file, you must use import:
->
To really change a global name in another module, you must use import:

########################################

Anonymous    Sep 01, 2006
Printed
Page 267
2nd line above 'Reload Example'

"Clients that used from to fetch attributes in the past won't be effected by a reload;"

NOW READS:
"Clients that used from to fetch attributes in the past won't be affected by a reload;"

Anonymous    Aug 01, 2005
Printed
Page 275
First line of paragraph immediately preceding "A tale of Three Systems" section

"Package imports can also greatly simply"

NOW READS:
"Package imports can also greatly simplify"

Anonymous    Aug 01, 2005
Printed
Page 278
3rd paragraph

irrelevent

NOW READS:
irrelevant

Anonymous    Aug 01, 2005
Printed
Page 279
1st paragraph, 2nd line

funtions

NOW READS:
functions

Anonymous    Aug 01, 2005
Printed
Page 281
paragraph before "Changing the Module Search Path"

"functionalty" NOW READS "functionality"

Anonymous    Aug 01, 2005
Printed
Page 283
2nd line

... that code runs and is disgarded immediately...

NOW READS:
... that code runs and is discarded immediately...

Anonymous    Aug 01, 2005
Printed
Page 304
4th para 2nd sentence

'rather than changing exiting code in-place'

NOW READS:
'rather than changing existing code in-place'

Anonymous    Aug 01, 2005
Printed
Page 312
3rd paragraph

'it doesn't effect'

NOW READS:
'it doesn't affect'

Anonymous    Aug 01, 2005
Printed
Page 366
2nd to last paragraph

"reprresentation"

NOW READS:
"representation"

Anonymous    Aug 01, 2005
Printed
Page 369
Paragraph 1

"fully expended name"

NOW READS:
"fully expanded name"

Anonymous    Aug 01, 2005
Printed
Page 372
middle of page

"this change only effects"

NOW READS:
"this change only affects"

Anonymous    Aug 01, 2005
Printed
Page 391
Second paragraph

In the second sentence,

"toipic" NOW READS "topic"

and

"libray" NOW READS "library"

Anonymous    Aug 01, 2005
Printed
Page 401
Second code block

Missing ":" at the end of the except IndexError line HAS BEEN ADDED.

Anonymous    Mar 01, 2005
Printed
Page 433
Table 26-1, Attributes row

-name-
->
__name__

########################################

Anonymous    Sep 01, 2006
Printed
Page 434
IDE section

some advance IDEs
->
some advanced IDEs

########################################

Anonymous    Sep 01, 2006
Printed
Page 435
-1

-name-
->
__name__

########################################

Anonymous    Sep 01, 2006
Printed
Page 435
3rd paragaph, last line

...20% faster them 2.2
should be
...20% faster than 2.2

########################################

Anonymous    Jun 01, 2007
Printed
Page 440
+1

yeteminently
->
yet emininently

########################################

Anonymous    Sep 01, 2006
Printed
Page 444
The "safeint" example

def safeint(candidate):
converted = float(candidate)
rounded = round(converted)
if converted == rounded:
return int(converted)
else:
raise ValueError, "%s would lose precision when cast" % candidate

->

def safeint(candidate):
converted = float(candidate)
truncated = int(converted)
if converted == truncated:
return truncated
else:
raise ValueError, "%s would lose precision when cast" % candidate

########################################

Anonymous    Sep 01, 2006
Printed
Page 457
class Stack: code

self.push and self.pop BOTH NOW REFERENCE self._data, not just data

Anonymous    Nov 01, 2004
Printed
Page 457
-1

see Chapter 7
->
see Chapter 23

########################################

Anonymous    Sep 01, 2006
Printed
Page 460
Table 27-4, Behavior column

directory tree rotted
->
directory tree rooted

########################################

Anonymous    Sep 01, 2006
Printed
Page 464, 468, 471
in code snippet

", string" in the import statement of these examples HAS BEEN DELETED.

Anonymous    Nov 01, 2004
Printed
Page 470
last line in 1st code snippet

Previously the last line of this code was indented too far.

"# Process character 'next'." HAS BEEN MOVED 4 spaces to the left to correct this error.

Anonymous    Nov 01, 2004
Printed
Page 475
1st parag under Specific Internet Protocols

"smptlib"

NOW READS:
"smtplib"

Anonymous    Nov 01, 2004
Printed
Page 479
last line of code near the bottom of the page

apply(self.__init__, (self,) + args), kw)

NOW READS:
apply(self.__init__, (self,) + args, kw)

Anonymous    Mar 01, 2005
Printed
Page 479
2nd code section from bottom

self.__init__(self, *args, **kw)
->
Base.__init__(self, *args, **kw)

########################################

Anonymous    Sep 01, 2006
Printed
Page 482
code between +2 and +3

for func in funcs:
totals[func] = 0.0
starttime = time.clock()
for x in range(num_times):
for func in funcs:
apply(func)
stoptime= time.clock()
elapsed = stoptime-starttime
totals[func] = totals[func] + elapsed

->

for func in funcs:
totals[func] = 0.0
starttime = time.clock()
for x in range(num_times):
apply(func)
stoptime= time.clock()
elapsed = stoptime-starttime
totals[func] = totals[func] + elapsed

########################################

Anonymous    Sep 01, 2006
Printed
Page 482
code between +2 and +3

print 'Running %s %d times took %.3f seconds' % (func.__name__, num_times
totals[func])

->

print 'Running %s %d times took %.3f seconds' % (func.__name__, num_times,
totals[func])

########################################

Anonymous    Sep 01, 2006
Printed
Page 483
code at top of page

>>> from makezeros import *
>>> profile.run(...)

->

>>> from makezeros import *
>>> import profile
>>> profile.run(...)

########################################

Anonymous    Sep 01, 2006
Printed
Page 486
Figure 28-1

The title of the webpage in Figure 28-1 reads
"Comments and Complaints Form - Joe's Toothpase, Inc. - Netscape"
There should be a 't' in "Toothpase".

Anonymous   
Printed
Page 571
Exercise 5

print '
'.join(os.listdir(dirname)
->
print '
'.join(os.listdir(dirname))

########################################

Anonymous    Mar 01, 2007
Printed
Page 577

Under arguments:
Please add "arbitrary" and/or "extended calling" with page 212
One term is used by the book while the other is found in FAQs.

Anonymous   
Printed
Page 577
index

% (remainder/format) operator, 58
->
% (remainder/format) operator, 58, 87-90

########################################

Anonymous    Mar 01, 2007
Printed
Page 578

Under calling:
add "arbitrary arguments" and/or "extended calling" with page 212

Anonymous   
Printed
Page 579
2nd column

The line "COM (Microsoft Common Object Model), 447, 454": there are no references to COM in either page.

Anonymous   
Printed
Page 583

Under iteration:
The group "iteration" doesn't include pages about iterators.
Perhaps pages 233 and 236 should be added.

Anonymous   
Printed
Page 587

"PIL (Python Imaging Library), 485"
The page number is way off. It should be 523.

Anonymous   
Printed
Page 591
Y

The 'yield' statement should be in the index.
Also, remove 'you' from the index!

Anonymous