circular imports

Peter Hansen peter at engcorp.com
Fri May 20 16:04:26 EDT 2005


qhfgva at gmail.com wrote:
> I'm working with a large code base that I'm slowly trying to fix
> "unpythonic" features of.
[...]
> Insead I'd rather have PYTHONPATH already include '/general/path/'
> and then just use:

One option you might not have considered, which I find more "pythonic" 
than environment variables, is to use .pth files as documented at the 
top of the site.py module in the standard library (or in the online docs 
for "site").

You can also sometimes remove even more problems by using a 
sitecustomize.py file in addition to the .pth files.  (Also in the docs, 
I believe, under "site".)

-Peter



More information about the Python-list mailing list