[Tutor] Style question with classes and modules

Tino Dai tinoloc at gmail.com
Thu Jul 19 21:03:34 CEST 2007


Hi there Everybody,

       I have style question with importing of modules and classes.
Presently, I have several files importing several modules.

#apacheModule
import dbBase
import dbCommon
import miscBase

My question is there any advantage to me wrapping them in a single file
(wrapper), and the importing a single file
into that file (barring namespace collisons). Example shown below:

In aggreateBase:
import dbBase
import dbCommon
import miscBase

In apacheModule:
import aggreateBase
# instead of
#import dbBase
#import dbCommon
#import miscBase

or perhaps even
In aggreateBase:
from dbBase import dbBase
from dbCommon import dbCommon
from miscBase import miscBase

The two advantages that I can see are, I don't need to type as much, and
there would be a speed up in the execution of code.
Is there a reason why I shouldn't?

Thanks in advance,
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070719/a4ba5127/attachment.htm 


More information about the Tutor mailing list