[Import-SIG] Proposal for a lazy-loading finder

Nick Coghlan ncoghlan at gmail.com
Sun Jul 9 03:02:46 EDT 2017


On 9 July 2017 at 09:56, Brett Cannon <brett at python.org> wrote:
> Please have a look at
> https://notebooks.azure.com/Brett/libraries/di2Btqj7zSI/html/Lazy%20importing.ipynb
> and let me know if I'm missing anything. I asked on Twitter if this would
> work for Mercurial and it turns out it closely mirrors what they already do:
> https://twitter.com/sid0/status/882775009051123712 (which is great since I
> didn't look at their code to avoid any GPL issues even though our
> relationship with the Mercurial devs is good enough to not have them sue us
> over code re-use :) . With independent verification that the approach works
> I'm fairly confident this can go into Python 3.7, but I still wanted to
> double-check with this mailing list to make sure the API design and approach
> seem sound.

The technical approach seems sound, but from a naming perspective I'd
suggest going with the more self-explanatory "ensure_lazy" and
"ensure_eager" rather than "whitelist" and "blacklist".

I'd also suggest that it would be nice to be able to do prefix
matching rather than having to separately list every submodule of a
package in either ensure_lazy or ensure_eager.

Cheers,
Nick.

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


More information about the Import-SIG mailing list