defnumdefrep may vary per stmt def runner(stmtspythons=nonetracecmd=false)""main logicrun tests per input listscaller handles usage modes stmts[(number?repeat?stmt-string)]replaces $listif in stmt pythonsnone=this python onlyor [(ispy ?python-executable-path)""print(sys versionfor (numberrepeatstmtin stmtsnumber number or defnum repeat repeat or defrep =default if not pythonsrun stmt on this pythonapi call no need to split lines or quote here ispy sys version[ =' stmt stmt replace('$listif ''listif ispy else ''best min(timeit repeat(stmt=stmtnumber=numberrepeat=repeat)print(' [% ](beststmt[: ])elserun stmt on all pythonscommand line split lines into quoted arguments print('- print('[% ]stmtfor (ispy pythonin pythonsstmt stmt replace('$listif ''listif ispy else ''stmt stmt replace('\ ' lines stmt split('\ 'args join('"% "line for line in linescmd '% - timeit - % - % % (pythonnumberrepeatargsprint(pythonif tracecmdprint(cmdprint('\tos popen(cmdread(rstrip()this file is really only half the picturethough testing scripts use this module' functionpassing in concrete though variable lists of statements and pythons to be testedas appropriate for the usage mode desired for examplethe following scriptpybench_cases pytests handful of statements and pythonsand allows command-line arguments to determine part of its operation- tests all listed pythons instead of just oneand an added - traces constructed command lines so you can see how multiline statements and indentation are handled per the command-line formats shown earlier (see both filesdocstrings for details)""pybench_cases pyrun pybench on set of pythons and statements select modes by editing this script or using command-line arguments (in sys argv) run " :\python \python pybench_cases pyto test just one specific version on stmts"pybench_cases py -ato test all pythons listedor "py - pybench_cases py - -tto trace command lines too the benchmarking interlude