PyChecker must execute script?

Just just at
Wed Feb 5 23:09:59 CET 2003

In article <mailman.1044481572.29181.python-list at>,
 Trent Mick <trentm at> wrote:

> [Geoff Gerrietts wrote]
> > I believe PyChecker imports the modules, and analyzes the resulting
> > bytecode.
> Yes.

What I don't understand is if it analyzes *byte code* then why it must 
do a full import? Wouldn't a plain compile() suffice then? There must be 
more to it.

> > If you have not included an "if __name__ == '__main__':" conditional,
> > then it is likely that importing the module and running it will be
> > fundamentally identical.
> To be more specific. If you put all top-level executing code within a
>     if __name__ == "__main__":
>         # top-level code here
> block then you will be fine.

A class or def statement is also top-level executing code, as are any 
constant definitions and imports, so this definition is way to strict...


More information about the Python-list mailing list