Does python always need to compile ENTIRE program before it can start to run it???
Michael T. Babcock
mbabcock at fibrespeed.net
Mon Nov 3 14:37:38 EST 2003
> 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.
>
Yes. You can have Python code that wouldn't "compile" but still runs.
As long as the paths the interpreter takes have no errors, you're fine
(minor exception of syntax errors).
class a:
def __init__(self):
help # syntax error if we initialize an instance of a()
print "hello world"
... that'll still run 'fine' because you don't use "a"
That said, the "compilation" time of a Python program is almost
nonexistant in most cases. Most of the work is runtime; load a class,
wait for the class to compile, and so on..
--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock
More information about the Python-list
mailing list