Peter Hansen wrote:

Matt Gerrans wrote:

"Peter Hansen" <[EMAIL PROTECTED]> wrote:

Only pure Python code can run without change on a newer interpreter.


Is the interpreter smart enough to rebuild a pyc (if the corresponding py file is there of course) file that was built by a previous version?


Yes.  The .pyc files contain a magic cookie that is
different in each major version, so 2.4 will recompile
your 2.3 .pyc files.   .pyc files are not portable
between versions, generally, excepting maintenance releases.

-Peter

In fact this hidden recompilation, when it has to be applied to large libraries, can impact performance considerably. I first came across this when testing an application (which had its own, quite significant, libraries) for compatibility between Cygwin and the standard Windows interpreter, across different version numbers.


It was only when I started to look at file creation times I twigged that running the program (for the first time only) under a different regime was causing the libraries to be recompiled. Then the reason for the inconsistency in run times was then obvious.

regards
 Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to