Does python always need to compile ENTIRE program before it can start to run it???

John Roth newsgroups at jhrothjr.com
Mon Nov 3 14:20:41 EST 2003


"Christian Seberino" <seberino at spawar.navy.mil> wrote in message
news:bf23f78f.0311031044.478bf786 at posting.google.com...
> I can achieve something similar to Python's automatic compilation
> in C/C++ by making a script that compiles and runs my program like this:
>
>
> make ; myprogram
>
>
> I am trying to think of an advantage Python has over this hack....
>
> Is it true that unlike C/C++ that Python programs can start executing
> before compilation is COMPLETELY done???  I think so but I'm not sure.

Since Python is a compiled language, yes, the programs have
to be compiled before they run. However, Python saves the
compiled version of all modules *except* the top level script,
so it doesn't have to be redone on each execution. I've never
gotten a satisfactory explanation of why it doesn't save the compiled
version of the top level script, but then, I've never really looked
into it. It's just curious.

Compilation must be finished before the import statement can complete.

John Roth

>
> Chris






More information about the Python-list mailing list