multiple import of a load of variables

Torsten Bronger bronger at physik.rwth-aachen.de
Wed Mar 16 12:05:17 CET 2005


Hallöchen!

"Fuzzyman" <fuzzyman at gmail.com> writes:

> [...]
>
> I'm not entirely clear what you are trying to do

The following: "variables.py" looks like this

a = 1
b = 2

Then I have helper_a.py, helper_b.py, and helper_c.py which begin
with

from variables import *

And finally, my_module.py starts with

from variables import *
from helper_a.py import *
from helper_c.py import *
from helper_c.py import *

Now imagine that variables.py contained not only two but hundreds of
variables.  Is this then still the most effective approach?

> *but* - if you import the same module in several places (per
> interpreter instance of course) the import will only be done
> *once*. The other import statments just make that namespace
> available from the namespace that does the import.

Even if I use "from"?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus



More information about the Python-list mailing list