FW: Re: [Tutor] compiler

dman dsh8290@rit.edu
Mon, 19 Nov 2001 22:19:13 -0500


| ----- Forwarded message from Kirk Bailey <deliberatus@my995internet.com> -----
| 
| From: Kirk Bailey <deliberatus@my995internet.com>
| Date: Mon, 19 Nov 2001 20:39:16 -0500
| To: dman <dsh8290@ritvax.isc.rit.edu>
| X-Mailer: Mozilla 4.74 [en] (Win98; U)
| 
| Is there nothing that will take a python script, and compile it in
| runtime executable code?

There is Gordon McMillan's "installer" and "py2exe", but they
basically just package up the interpreter and your source into a
single easy-to-install package.

| Python is wonderful, but a executable in machine language compiled
| from something is a lot faster, which is VERY handy if ou use the
| thing a lot.

Not really -- the crux is that python is dynamically typed.  The
compiler would need to be extrememly sophisticated and slow to perform
a complete flow analysis in order to ensure that any given operation
can be optimized (that only, for example, integers, are going to be
added).  Even that is not possible if eval(), or exec are used.
Basically, even if you did compile the python source down to machine
code, it would still need to be linked with the interpreter to handle
the dynamicness and it wouldn't be much, if any, faster.  Python
really isn't too slow anyways.

HTH,
-D