On 2009-04-16 15:26, Gael Varoquaux wrote:
> On Thu, Apr 16, 2009 at 03:21:08PM -0500, Robert Kern wrote:
>> No, Gaël, setuptools does not alter sys.path to support namespace packages. It
>> alters the .__path__ of the package, which is precisely what the .__path__
>> feature was made to support.
> Thanks for the correction.
> It is however a half-assed implementation (I don't know who's fault it
> is), as it gives import and builtins.__import__ yielding different
> results, if I am not mistaken?
You are mistaken.
> I am thinking of the toolkit import magic
> of traits, that is broken if you have a namespace package and a non
> namespace package package installed on your system.
No, that's a general problem with just about any namespace package strategy. All
of the __init__.py's with the namespace need the bit of boilerplate that
modifies the .__path__ attribute. Otherwise, Python might hit the __init__.py
that looks like a regular package, and then it has no way of knowing that it
needs to look in other locations for imports underneath it.
Please, suspend your judgment. Declaring half-assedness from a state of
ignorance doesn't serve any purpose.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco