(though we're also effectively timing the list call for the generator test)return [abs(xfor in repslistreturn list(abs(xfor in repslist seconds secondsdiffers internally though the exact cause would require deeper analysis (and possibly source code study)this seems to make sense given that the generator expression must do extra work to save and restore its state during value productionthe list comprehension does notand runs quicker by small constant here and in later tests interestinglywhen ran this on windows vista under python for the fourth edition of this bookand on windows xp with python for the thirdthe results were relatively similar--list comprehensions were nearly twice as fast as equivalent for loop statementsand map was slightly quicker than list comprehensions when mapping function such as the abs (absolute valuebuilt-in this way python ' absolute times were roughly four to five times slower than the current outputbut this likely reflects quicker laptops much more than any improvements in python in factmost of the python results for this script are slightly quicker than on this same machine today-- removed the list call from the map test in the following to avoid creating the results list twice in that testthough it adds only very small constant time if left inc:\codec:\python \python timeseqs py (defaultapr : : [msc bit (amd )forloop =[ listcomp =[ mapcall =[ genexpr =[ genfunc =[ for comparisonfollowing are the same testsspeed results under the current pypythe optimized python implementation discussed in whose current release implements the python language pypy is roughly (an order of magnitudequicker hereit will do even better when we revisit python version comparisons later in this using tools with different code structures (though it will lose on few other tests as well) :\codec:\pypy\pypy- \pypy exe timeseqs py ( ffjun : : [pypy with msc bitforloop =[ listcomp =[ mapcall =[ genexpr =[ genfunc =[ the benchmarking interlude