On Thu, Jul 11, 2013 at 9:33 AM, Paul Moore <p.f.moore@gmail.com> wrote:
On 11 July 2013 13:49, Brett Cannon <brett@python.org> wrote:
The dead-simple, extremely elegant solution (starting in Python 3.4) is to make pip a namespace package in the stdlib with nothing more than a __main__.py file that installs pip; no checking if it's installed and then running it, etc, just blindly install pip. Then, if you install pip as a regular package, it takes precedence and what's in the stdlib is completely ignored (this helps with any possible staleness with the stdlib's bootstrap script vs. what's in pip, etc.). You don't even need to change the __main__.py in pip as it stands today since namespace packages only work if no regular package is found.
Wow - that is exceptionally cool. I had never realised namespace packages would work like this.
Not exceptionally cool ... and that's why the namespace_package form is popular, since the first package in a set of namespace packages that gets it wrong breaks everything.