import guards?

Michael Mossey michaelmossey at yahoo.com
Tue May 6 20:01:27 EDT 2003


Is it inefficient in Python to have something like:

myprog.py:
-------

from mylib import *
from math import *


mylib.py
------------

from math import *



Does this do the work of importing math twice?  Perhaps that is
no big deal since it certainly won't compile math twice (or at
all, seeing as it is a built-in, but I might create a similar
situation with non-built-in modules).

And if this does cause it do something disk-intensive twice,
could I put a sort of "import guard" around the import
statements?  I'm not sure what that would look like.

Regards,
Michael




More information about the Python-list mailing list