Import a module without executing it?
Jay O'Connor
joconnor at cybermesa.com
Tue Dec 7 19:34:37 EST 2004
Lonnie Princehouse wrote:
>>The real question, I suppose, is "what is a good technique to find
>
> what
>
>>modules and classes implement or refer to particular names"
>
>
> I think your best bet is still to import the module and introspect it.
> It will execute some code, but (by convention) simply importing a
> module doesn't usually unleash any spectacular computation. Scripts
> meant to be executed from the command line will almost always have an
> (if __name__ == '__main__' ) clause to prevent just this.
Well, I sorta ran into that trouble testing some testfiles of
mine...little scripts for testing specific things that did'nt follow
convension in that manner
Thanks
Take care,
Jay
More information about the Python-list
mailing list