Where to import modules?
Mel Wilson
mwilson at the-wire.com
Thu Oct 2 11:13:48 EDT 2003
In article <3F74375A.F9D4B0EB at engcorp.com>,
Peter Hansen <peter at engcorp.com> wrote:
>I would not bother putting imports that are rarely used in only the
>functions which need them *unless* I had a really large module which
>took a long time to import and I was actually having problems with
>startup time for the application.
I can see a case for
if __name__ == '__main__':
import getopt
...
and even sys (for sys.argv), if the rest of the module
doesn't deal with sys. But that's because running as the
main module instead of a library module is a big change in
operating environment and rationale.
Regards. Mel.
More information about the Python-list
mailing list