Python bytecode compatibility between interpreter versions

Andrew MacIntyre andymac at bullseye.apana.org.au
Sun Mar 21 00:36:46 CET 2004


On Sat, 20 Mar 2004, Jon Perez wrote:

> Right.  I am aware that freezing is the optimal way to distribute
> apps written in Python today.  After trying out Java though, I have
> to say I'm impressed with the way you can take a bunch of class
> files archived in the exact same jarfile to *ANY* computer with a
> JRE installed, type in java -jar jarfile and have it run _identically_.
>
> Perhaps one day .pyc files can work in such a manner.

Perhaps.

However there is a clear differentiation between Java and Python
in this area:
- Java has always been specified in terms of the language and a
  virtual machine design (which implies a portable binary form files for
  executables - jar files);
- Python has always been specified in terms of the language, with a
  portable reference interpreter implementation for that language (which
  just happens to compile to bytecode, and save that bytecode to disk
  as an optimisation).

IOW, the bytecode is an implementation detail for _one_ interpreter
implementation.

This becomes obvious when you consider the possibilities associated
with Jython, which could (already does?) compile Python source to jar
files directly.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia




More information about the Python-list mailing list