[Import-SIG] PEP proposal: Per-Module Import Path

Nick Coghlan ncoghlan at gmail.com
Sat Jul 20 17:38:39 CEST 2013


On 20 July 2013 23:55, Brett Cannon <brett at python.org> wrote:
> On Sat, Jul 20, 2013 at 3:32 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> I'm not currently sure what I would do about __indirect__ if the
>> result was a namespace package. In that case, you really want it to be
>> a mapping from path entries to the indirections that located them (if
>> any), which suggests we may want it to be a mapping whenever
>> indirection occurs (from __file__ to the indirection chain for the
>> simple case), or None if no indirection was involved in loading the
>> module.
>
> Could you do it post-import? I mean the process of finding the .ref files is
> the same, so you could just look for the files, accumulate the list, and
> then see which ones ended up on __path__ and see "this is where these came
> from". That does away with any potentially nasty API changes to make
> __indirect__ work.

I'm not going to think about it much more until Eric has a chance to
chime in with how he solved the reference loop detection problem for
his draft implementation. I still suspect that whatever mechanism
handles the loop detection will be able to accumulate the __indirect__
entries as it goes (regardless of the exact data structure we end up
using).

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Import-SIG mailing list