Package Organization (was Re: [Zope3-dev] Voting on Schema design)
Guido van Rossum
guido@python.org
Mon, 15 Jul 2002 13:43:09 -0400
> >> There's one technical glitch which might argue against a Zope
> >> top-level placeholder. If you ever want to import some
> >> Zope.PackageA from a different directory than Zope.PackageB you
> >> will be stuck because Python won't search two directories for a
> >> package's contents.
>
> GvR> Yes it will, if the package's __init__ adds to its __path__.
>
> Which package, and which __init__? I'm having a hard time seeing how
> that would be manageable.
In this case, the global variable __path__ in package Zope. There
could be code in its __init__.py that walks over sys.path and looks
for other directories named Zope and adds them all to __path__.
(This is a little-known detail of the package interface I guess.
There's some info about it in
http://www.python.org/doc/essays/packages.html.)
--Guido van Rossum (home page: http://www.python.org/~guido/)