Package organization: where to put 'common' modules?

Jorge Godoy godoy at ieee.org
Sat Mar 4 08:42:36 EST 2006


Kent Johnson <kent at kentsjohnson.com> 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
>
> http://www.python.org/peps/pep-0328.html

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 ieee.org>

"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