Importing modules

Mudcat mnations at
Wed Jan 21 19:13:18 CET 2009

On Jan 21, 11:29 am, alex23 <wuwe... at> wrote:

> Well, you can always stick those imports into a '' and do
> 'from common import *' in each file that uses them. But doing so can
> be a pain to maintain and debug for anything more than the most simple
> of applications. Being able to see a module's dependencies clearly
> listed at the top of the file is exceptionally handy.

I x-posted the same thing but am curious why you think it's such a
problem to maintain. Having dependencies at the top is handy only
because it's usually quicker to get to the top of a file than it is to
open up another one. However if you have your common file open in your
IDE you can have it open in a split window where it's viewable all the
time. As long as you don't go crazy with "import *" in your common
file then you shouldn't get into trouble with duplicated namespaces.
As I mentioned before it should also cut down on the circular

So just preference aside, is there any problems with the actual
execution of the code if it's done this way? To me it simply compares
to putting an __init__ file in a package, except it applies to only
one directory.

More information about the Python-list mailing list