Learning Python, 2nd Edition by Mark Lutz, David Ascher The following errata were *corrected* in the 09/06 reprint: This page was updated February 20, 2007 Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification +n: n'th paragraph from the top of the page -n: n'th paragraph from the bottom of the 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). ######################################## (144) middle of sidebar sys.sytdout -> sys.stdout ######################################## (172) 3rd line of the "The dir Function" section atributes -> attributes ######################################## {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: ######################################## (433) Table 26-1, Attributes row -name- -> __name__ ######################################## (434) IDE section some advance IDEs -> some advanced IDEs ######################################## (435) -1 -name- -> __name__ ######################################## (440) +1 yeteminently -> yet emininently ######################################## (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 ######################################## (457) -1 see Chapter 7 -> see Chapter 23 ######################################## (460) Table 27-4, Behavior column directory tree rotted -> directory tree rooted ######################################## [479] 2nd code section from bottom self.__init__(self, *args, **kw) -> Base.__init__(self, *args, **kw) ######################################## [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 ######################################## [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]) ######################################## {483} code at top of page; >>> from makezeros import * >>> profile.run(...) -> >>> from makezeros import * >>> import profile >>> profile.run(...) ########################################