On Fri, 23 Mar 2007 22:24:07 +1100, Steven D'Aprano wrote: > if not os.path.exists(compiledname) or \ os.stat(compiledname)[MT] < > os.stat(scriptname)[MT]: > # compiled file doesn't exist, or is too old
Surely the validity check done by Python is more sophisticated than this? Doesn't the binary file have to be compiled under the same python version etc? > Now don't forget to test whether launching the subshell takes longer > than the 20ms you might save. All that effort, and wouldn't it be ironic > if it was actually *slower* than executing the script from scratch each > time... But Python proper is executing all the above anyhow isn't it? So the 20 msecs advantage I measured already includes this logic. Anyhow, I give up. Compilation, it seems, only applies to python modules. Compilation is not appropriate for Python scripts. Should be in the FAQ. -- http://mail.python.org/mailman/listinfo/python-list