[Zope-dev] multiple packages in the same namespace

Tres Seaver tseaver at palladion.com
Mon Feb 9 10:14:32 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dieter Maurer wrote:
> Christian Theune wrote at 2009-2-7 09:36 +0100:
>> ...
>> According to the setuptools documentation and our experiments on the
>> sprint, this is supposed to work and does work:
>>
>> "When you declare a package to be a namespace package, it means that the
>> package has no meaningful contents in its __init__.py, and that it is
>> merely a container for modules and subpackages."
>>
>>>> If so, which packagea/__init__.py gets used?
>> Only the __init__.py isn't allowed to have code is what I read from the
>> documentation.
> 
> However, extreme care must be taken to avoid name clashes.

As with any namespace, sure.  But there would be no point in namespace
packages at all if modules or subpackages couldn't be placed in them.

> For Modules/packages with the same name it is not deterministic
> which of them will actually be loaded. "__init__.py" is just
> a common case of this problem.

It is the one which is guaranteed to clash, since its absence makes a
directory not-a-package at all.  Setuptools documents that every
directory participating in a namespace package must have the "declare a
namespace" boilerplate in its __init__.py, and *nothing else*.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkEhY+gerLs4ltQ4RAqxIAJ9ds65eHMxyMFjltbPrSglCe03KHQCfVSyS
UHJV4bm84NLy29xhNJzfz8o=
=6Htc
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list