Import a module without executing it?

Andy Gross andy at
Tue Dec 7 22:29:00 CET 2004

On Dec 7, 2004, at 4:20 PM, Steven Bethard wrote:
> If you have source control over this file, you could write it with the 
> more standard idiom...

I should have mentioned this first.  If you're just trying to avoid 
existing top-level code from being executed, use the if __name__ == 
"__main__" idiom.

More information about the Python-list mailing list