PEP 338: Executing modules inside packages with '-m'

Just just at
Tue Dec 14 09:10:32 CET 2004

In article <mailman.7618.1102955005.5135.python-list at>,
 "Fredrik Lundh" <fredrik at> wrote:

> Nick Coghlan wrote:
> >>     $ python -c "import" arg
> >
> > This doesn't work. Any code protected by "if __name__ == '__main__':" won't 
> > run in this context 
> > (since '' is being imported as a module, not run as a script).
> I appreciate that you're taking the time to teach me about Python, but I can
> assure you that it's not really needed.

Neither is the sarcasm.

> as for the rest of your arguments, I have to assume that you were joking.  
> (or
> that you have no experience whatsoever of distribution of Python programs in
> Unix and Windows environments).

Whatever. You suggestion does not work in many cases. How about a 
program that starts threads? Can't do that as a side effect of import.


More information about the Python-list mailing list