Re: Proposal for a lazy-loading finder
Eric Snow <[email protected]> Mon, 10 Jul 2017 13:40:40 -0600
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CALFfu7CRFYQPyjy8C3qFS-5=+uXHT+61QyNODNG957w23q8DxA@mail.gmail.com> |
On Sat, Jul 8, 2017 at 5:56 PM, Brett Cannon <[email protected]> wrote: > [snip] > I figured it was finally time to implement a lazy-loading finder > to make sure people don't duplicate the same work and to make sure that it > is implemented properly and can change as importlib itself does. > [snip] > > 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. LGTM. It's good that the class mirrors FileFinder. The only things I'd possibly suggest are: * name the class LazyLoadingFileFinder * make activate_lazy_loading() be a classmethod on PathFinder Both make it clear that they only relate to path-entry finders. I have some other concerns but they aren't problems with your proposal. :) Mostly, I still want to see a better high-level interface to the import machinery (i.e. "ImportSystem"). Having to poke things directly into the import state (e.g. sys.path_hooks) isn't ideal. However, I don't think my concerns are critical for this proposal so I won't elaborate here. :) -eric