On Mon, 02 Jul 2007 16:14:41 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >Evan Klitzke wrote: >> On 7/2/07, Cathy Murphy <[EMAIL PROTECTED]> wrote: >>> Is python a compiler language or interpreted language. If it is interpreter >>> , then why do we have to compile it? >> >> It's an interpreted language. It is compiled into bytecode (not >> machine code) the first time a script is run to speed up subsequent >> executions of a script. >> >While the flavor of this answer is correct, in strict point of fact >Python *doesn't* compile the scripts it executes, only the modules that >are imported. > >That's why you will occasionally see a very small Python program that >just calls functions imported from much larger modules. This avoids >spending the time that would otherwise have to be spent recompiling a >large script at each execution.
Hey Steve, To nit pick :) Wouldn't you say it is more accurate to say that it does compile the scripts (by which we mean the "main" file - either the one passed as an argument to the interpreter on the command line, or the one with a #! at the top which gets respected, or the .py file on Windows which is associated with python.exe as its interpreter), but that it doesn't save the results of this compilation to a file to be used next time? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list