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

James Kew james.kew at btinternet.com
Mon Nov 3 18:12:17 EST 2003


"John Roth" <newsgroups at jhrothjr.com> wrote in message
news:vqdamhn2pq1qaf at news.supernews.com...

> 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.

I've always wondered that too. The top-level script _might_ be standard
input or command-line, but it seems to me that it often (usually?) is a .py
which _could_ be stashed into a .pyc.

Taken to extremes, it suggests that top-level scripts should be as small as
possible: an if __name__ == "__main__" delegating immediately to a worker
function imported from a helper module. I'm not sure there's anything
realistic that's code-heavy and short-running enough for it to make much
difference, though...

James






More information about the Python-list mailing list