Can I compile Python for the web?
peter at engcorp.com
Sat Sep 24 02:53:13 CEST 2005
> I'm doing some investigations on the Python language.
> I'd like to know if it is possible to compile Python code made for the
> web (an online database for instance), and to run it using mod_python.
> How is it possible? I think it would be very fast to execute the code
> if it were compiled.
Python code is already compiled, specifically to .pyc files, though this
is clearly not what you meant by the above. (The .pyc files contain
"bytecode" which is executed by the Python virtual machine, much like a
CPU executes its native opcodes, or like Java executes its own bytecode
What you appear to be asking is if it's possible to create *native
machine code* from Python source in order to achieve a significant
increase in performance. The short answer is "no, not really", and
longer answers include "yes, sort of, using something like Psyco", and
"who cares because it wouldn't give you much better performance for a
web-based application where you're probably either I/O-bound or limited
by the speed of the non-Python database solution you are using in the
More information about the Python-list