[Python-Dev] PEP 382: Namespace Packages
mal at egenix.com
Tue Apr 7 14:02:54 CEST 2009
On 2009-04-03 02:44, P.J. Eby wrote:
> At 10:33 PM 4/2/2009 +0200, M.-A. Lemburg wrote:
>> Alternative Approach:
>> Wouldn't it be better to stick with a simpler approach and look for
>> "__pkg__.py" files to detect namespace packages using that O(1) check ?
>> One of the namespace packages, the defining namespace package, will have
>> to include a __init__.py file.
> Note that there is no such thing as a "defining namespace package" --
> namespace package contents are symmetrical peers.
That was a definition :-)
Definition namespace package := the namespace package having the
This is useful to have since packages allowing integration of
other sub-packages typically come as a base package with some
basic infra-structure in place which is required by all other
If the __init__.py file is not found among the namespace directories,
the importer will have to raise an exception, since the result
would not be a proper Python package.
>> * It's possible to have a defining package dir and add-one package
> Also possible in the PEP, although the __init__.py must be in the first
> such directory on sys.path. (However, such "defining" packages are not
> that common now, due to tool limitations.)
That's a strange limitation of the PEP. Why should the location of
the __init__.py file depend on the order of sys.path ?
Professional Python Services directly from the Source (#1, Apr 03 2009)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2009-03-19: Released mxODBC.Connect 1.0.1 http://python.egenix.com/
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-list