Does python always need to compile ENTIRE program before it c an start to run it???
seberino at spawar.navy.mil
seberino at spawar.navy.mil
Mon Nov 3 15:27:54 EST 2003
Lance
Thanks for the info. I agree that the initial script you
run must be compiled completely before it can execute.
Does "completely" = all the imported modules too?
> When Python loads a module (.py file) from an 'import'
> statement, it will see if there is an already compiled version in the same
> directory and named the same except for the '.pyc' or '.pyo' extension. If
> it finds this file AND it is newer than the corresponding source code (.py)
> then it will load the saved compilation and then run it. If the file is not
> found or it is older than the source, then Python will compile the source,
> attempt to save the compiled version, and then it will execute it.
The first word of your comments above is "When". So if Python doesn't
load a module until 3 hours into the execution of a large Python
program then your recipe above (including compilation of module) won't
get run until 3 hours AFTER execution starts right?
Chris
More information about the Python-list
mailing list