[Import-SIG] PEP 420: Implicit Namespace Packages

Brett Cannon brett at python.org
Thu May 3 18:47:39 CEST 2012


On Thu, May 3, 2012 at 12:11 PM, PJ Eby <pje at telecommunity.com> wrote:

> On Thu, May 3, 2012 at 2:23 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
>> Standardising on a pattern also opens up the possibility of doing
>> something meaningful with it in get_data() later. One of the
>> guarantees of PEP 302 if that you should be able to do this:
>>
>>  data_ref = os.path.join(__file__, relative_ref)
>>  data =  __loader__.get_data(data_ref)
>>
>
> Um, namespace package modules shouldn't have a __loader__ either, should
> they?
>

No, they should (and PEP 302 now requires that). Namespace modules are
loaded by a loader, and thus should have it defined. It's all the other
optional interfaces that they don't need to have (e.g. NamespaceLoader
should have importlib.abc.Loader and probably none of the other ABCs).


>
>
> _______________________________________________
> Import-SIG mailing list
> Import-SIG at python.org
> http://mail.python.org/mailman/listinfo/import-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20120503/dd090958/attachment.html>


More information about the Import-SIG mailing list