Package organization: where to put 'common' modules?

Jorge Godoy godoy at
Sat Mar 4 14:42:36 CET 2006

Kent Johnson <kent at> writes:

> What I do is run always from the base directory (violates your first
> requirement). I make a util package to hold commonly used code. Then B and D
> both use
>   from util import foo
> In Python 2.5 you will be able to say (in D, for example)
>   from ..util import foo

I do work a bit different here.  When two programs start sharing code, then I
convert this code into a "library", i.e., I make it a module, put it in
PYTHONPATH and then import it.  Probably more than two projects will use it if
two of them already are :-)

Jorge Godoy      <godoy at>

"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.

More information about the Python-list mailing list