Learning Python by Mark Lutz and David Ascher The following changes were made in the 8/01 reprint: 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 <219> 3rd paragraph, 1st sentence; The order of cmp return value interpretations wass wrong here. It has been changed to: The cmp built-in returns a negative integer, 0, or a positive integer, depending on whether its first argument is less than, equal to, or greater than the second one. [240] Second half of page, code block; The "*" was removed from the do_timing function's def header. Also, a "," was added to the print statement at the end of do_timing. The code now reads: import time, makezeros def do_timing(num_times, funcs): totals = {} for func in funcs: totals[func] = 0.0 for x in range(num_times): for func in funcs: starttime = time.time() # record starting time apply(func) stoptime = time.time() # record ending time elapsed = stoptime-starttime # difference yields time elapsed totals[func] = totals[func] + elapsed for func in funcs: print "Running %s %d times took %.3f seconds" % (func.__name__, num_times, totals[func]) do_timing(100, (makezeros.lots_of_appends, makezeros.one_multiply))