let' start with this module' fundamentals before leveraging them in larger scripts with timeittests are specified by either callable objects or statement stringsthe latter can hold multiple statements if they use separators or \ characters for line breaksand spaces or tabs to indent statements in nested blocks ( \ \ttests may also give setup actionsand can be launched from both command lines and api callsand from both scripts and the interactive prompt interactive usage and api calls for examplethe timeit module' repeat call returns list giving the total time taken to run test number of timesfor each of repeat runs--the min of this list yields the best time among the runsand helps filter out system load fluctuations that can otherwise skew timing results artificially high the following shows this call in actiontiming list comprehension on two versions of cpython and the optimized pypy implementation of python described in (it currently supports python codethe results here give the best total time in seconds among runs that each execute the code string , timesthe code string itself constructs , -item list of integers each time through (see appendix for the windows launcher used for variety in the first two of these commands) :\codepy - python ( :bd afb ebf sep : : [msc bit import timeit min(timeit repeat(stmt="[ * for in range( )]"number= repeat= ) :\codepy - python (defaultapr : : [msc bit (amd )on win import timeit min(timeit repeat(stmt="[ * for in range( )]"number= repeat= ) :\codec:\pypy\pypy- \pypy exe python ( ffjun : : [pypy with msc biton win import timeit min(timeit repeat(stmt="[ * for in range( )]"number= repeat= ) you'll notice that pypy checks in at faster than cpython hereand whopping faster than cpython despite the fact that pypy is potentially slower -bit build this is small artificial benchmarkof coursebut seems arguably stunning nonethelessand reflects relative speed ranking that is generally supported by other tests run in this book (though as we'll seecpython still beats pypy on some types of codetiming iterations and pythons with timeit