[Import-SIG] PEP 420: Implicit Namespace Packages

PJ Eby pje at telecommunity.com
Fri May 4 02:05:15 CEST 2012


On Thu, May 3, 2012 at 6:20 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> I'd still prefer to just officially bless the existing "<whatever>"
> convention for non-filesystem imports over encouraging type checks on
> __loader__ or defining a new introspection interface for loaders.
>
> If we say "this is the stdlib convention" people are going to start using
> the same check as is now used in traceback.py
>
> The precedent is there with code objects, and I think it's a good example
> to follow.
>
Note that this messes with the idea of using the first directory as
filename -- anybody who joins with os.path.dirname(__file__) is going to
get a mess (on regular filesystem paths), which is (I'm guessing) why the
trailing separator idea was proposed in the first place.

Which kind of brings us full circle on that point.  I suppose we could just
say screw it, anybody implementing VFS importers had darn well better
understand os.path.join and friends, since PEP 302 requires it for get_data
anyway.

Still seems like a wart, but oh well.  OTOH, maybe it's better for people
munging __file__ to get a weird error all the time with namespace packages,
instead of something that works some of the time, and fails later?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20120503/f9266230/attachment.html>


More information about the Import-SIG mailing list