PyChecker must execute script?
just at xs4all.nl
Thu Feb 6 09:39:13 CET 2003
In article <mailman.1044486616.1085.python-list at python.org>,
Trent Mick <trentm at ActiveState.com> wrote:
> > > 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...
> Unless I have been operating under gross misconceptions only top-level
> code and "top-level class code" is executed on module import. For
[ snippo ]
I think we're talking past one another... I kindof lost track of the
context, but I think the OP complained that there was code executing
that we didn't want to, while using PyChecker. Then you said he'd be
fine if he would put all top-level code in an if __name__ == "__main__"
clause. To which I meant to reply that by that definition of top-level
code you have to put the entire module inside the if, which renders the
module useless... Either I have been totally unclear or I simply
misunderstand you. I know we both know how it works, I was just trying
to pick nits and failed ;-)
More information about the Python-list