[Python-Dev] Empty directory is a namespace?

martin at v.loewis.de martin at v.loewis.de
Sat Jun 23 17:55:24 CEST 2012


> That's true. I would have hoped for it to be recognized only when
> there's at least one module or package inside, but it doesn't sound
> easy to check for (especially in the recursive namespace packages case
> - is that possible?).

Yes - a directory becomes a namespace package by not having an __init__.py,
so the "namespace package" case will likely become the default, and people
will start removing the empty __init__.pys when they don't need to support
3.2- anymore.

If you wonder whether a nested namespace package may have multiple portions:
that can also happen, i.e. if you have z3c.recipe.ldap, z3c.recipe.template,
z3c.recipe.sphinxdoc. They may all get installed as separate zip files,
each contributing a portion to z3c.recipe.

In the long run, I expect that we will see namespace packages such as
org.openstack, com.canonical, com.ibm, etc. Then, "com" is a namespace
package, com.canonical is a namespace package, and com.canonical.launchpad
might still be a namespace package with multiple portions.

Regards,
Martin




More information about the Python-Dev mailing list