Simple Python Project Structure

George Sakkis george.sakkis at
Sat Oct 11 06:20:04 CEST 2008

On Oct 10, 9:26 pm, jay graves <jaywgra... at> wrote:
> On Oct 10, 7:17 pm, amit <amit.ut... at> wrote:
> > How do create my own modules and import them? Right now it works but
> > they all have to be in the same directory. For example,
> > project/
> > ....util/
> > ....config/
> > ....tests/
> >
> You need an file (it doesn't matter if it's empty) in the
> directory to turn it into a package.

I'm wondering if this is one of the few cases where Python's choice to
be explicit causes more trouble than it's worth. The official
reasoning is:
The files are required to make Python treat the
directories as containing packages; this is done to prevent
directories with a common name, such as "string", from unintentionally
hiding valid modules that occur later on the module search path.

Is this a real problem or a speculation ? I would guess that it's at
least as likely for a newbie to create a "" module than have
an irrelevant "string" subdirectory under a code directory tree.
Having to create an empty file as a flag to denote a package doesn't
seem very pythonic.


More information about the Python-list mailing list