here at office we have a library named after the company name and inside of it sublibraries, per project more or less, and in each sublibrary there might be more modules or libraries. we are using Django and this makes our hierarchy a couple of steps deeper...
I am a bit perplex about the differences among the following import instructions:
1:
import company.productline.specific.models, company.productline.base.models specific, base = company.productline.specific, company.productline.base2:
import company.productline.specific.models, company.productline.base.models from company.productline import specific, base
3:
from company.productline import specific, base import company.productline.specific.models, company.productline.base.models
the first style imports only the models
? what are then the names specific
and base
made available in the current namespace?
what happens in the initialization of modules if one imports first submodules and only afterwards the containing libraries?
maybe the neatest style is the last one, where it is clear (at least to me) that I first import the two modules and putting their names directly in the current namespace and that the second import adds the model
submodule to both modules just imported.
on the other hand, (1) allows me to import only the inner modules and to refer to them in a compact though clear way (specific.models
and base.models
)
not so sure whether this is question, but I'm curious to read comments.