Re: PEP proposal: Per-Module Import Path
Nick Coghlan <[email protected]>
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CADiSq7fWM6AgWVj3W=mnzqWM6o6Ukt+Gr1AXXNPZg1SGAcqO6w@mail.gmail.com> |
On 20 July 2013 23:55, Brett Cannon <[email protected]> wrote: > On Sat, Jul 20, 2013 at 3:32 AM, Nick Coghlan <[email protected]> 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 | [email protected] | Brisbane, Australia