Python compilation ??

Steve Holden steve at holdenweb.com
Mon Jul 2 16:14:41 EDT 2007


Evan Klitzke wrote:
> On 7/2/07, Cathy Murphy <cathy at nachofoto.com> 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.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list