Python bytecode compatibility between interpreter versions
Jon Perez
jbperez808 at yahoo.com
Mon Mar 22 12:03:06 EST 2004
Roger Binns wrote:
> In the Java world, the JVM is a seperate installable component.
> Some installers like ZeroG will install them for you. In general
> all Java bytecode is expected (but not required) to share the
> main system JVM.
Afaik, each app will start its own copy of a JVM.
> In Python, if you want to distribute an application, and you
> don't want the user to have to install Python or any extensions,
> you use one of the installer generators out there. They gather
> up the interpretter, your code and extension libraries and dump
> them all into one directory. They then include a stub that makes
> them all work together. It especially has no reliance on any
> pre-installed interpretter.
Like I mentioned earlier, I am aware of 'freezing' but having to bundle
an interpreter with every app is exactly what I would rather avoid...
> If you want to see this in action, try my project at
> http://bitpim.sf.net The downloads give you a program that runs
> on Windows, Mac and Linux without any prerequisites.
What would be great is to not have to choose between a Windows,
Mac or Linux or XXX download (like in a proper Java app).
> You are pedantically correct in that they both contain bytecode, but
> the level is different. *If* the JVM wrote out HotSpot compilations
> and profiling information, the resulting files would be analogous to
> .pyc files.
But you're not saying that .pyc files contain profiling information,
right? Because that is what it's sounding like...
> They would not be *required* for execution, and they
> would be automatically regenerated if necessary (eg if you changed
> source files). In theory it could then execute from them without
> requiring the original class files, but that would be an implementation
> specific thing.
Yes, this is the main difference between Java and Python. Python
prefers the source to be present, Java doesn't care.
> With the addition of zip imports in Python 2.3,
Correct me if I'm wrong, but I thought you just said earlier that
zip imports predated Java by several years and now you're saying
they've just been added to Python 2.3?
More information about the Python-list
mailing list