[Import-SIG] Namespace Packages resolution

Guido van Rossum guido at python.org
Tue Mar 13 16:48:27 CET 2012


On Tue, Mar 13, 2012 at 8:05 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
> First of all, I'm sorry for breaking the thread, I've just subscribed
> for it and have no email to reply to.
>
> In PEP 382 it was proposed to have explicit namespace packages markers
> '.pyp'.  And with that approach it was relatively easy to implement
> nested namespace packages, for instance:
>
>  package1/com.pyp/acme.pyp/package1/__init__.py
>
> and
>
>  package2/com.pyp/acme.pyp/package2/__init__.py
>
> So that we can later import
>
>  >>> from com.acme import package1, package2
>
> Is this possible with the new approach?

Yes, that is possible with the new approach -- the same approach (look
for foo/__init__.py and foo.py first, then fall back to foo/ and
collapse all foo/ you find) is meant to work at every level: toplevel,
in a package, in a subpackage, etc...

-- 
--Guido van Rossum (python.org/~guido)


More information about the Import-SIG mailing list