Cross-reference 'import' in a class hierarchy

Ben Finney bignose-hates-spam at
Tue Apr 8 02:07:56 CEST 2003

On Mon, 7 Apr 2003 10:45:58 GMT, Michael Hudson wrote:
>  Ben Finney <bignose-hates-spam at> writes:
> > Even if I [ensure a package is in the PYTHONPATH] on my computer,
> > it's not going to be so on someone else's computer when they
> > download my package tree.
>  It is a Fact Of Life that Python packages (and modules therein) need
>  to know where they are in the global module namespace.

Thanks to all who have offered this; the verdict seems to be unanimous.

My question, then, becomes this:  How does one gracefully ensure Python
can find the (potentially) myriad top-level directories under which
one's in-development projects reside?

Is freedom in choosing the directory structure -- such a useful tool in
maintaining similar copies of a directory tree during development --
lost to the need for an ever-changing PYTHONPATH, or, worse,
hand-altering package names within the Python scripts whenever things
move about?

I feel dim for not being able to see the answer, but it seems absurd to
me that one can't rename a directory and expect the scripts within it to
continue working without outside help.

 \                   "The best is the enemy of the good."  -- Voltaire |
  `\                                                                   |
_o__)                                                                  | 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B

More information about the Python-list mailing list