On Wed, Mar 27, 2013 at 6:59 PM, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 27 March 2013 21:19, Bradley M. Froehle <brad.froe...@gmail.com> wrote: > > I implemented just such a path hook ---- zipimporter plus the magic > required > > for C extensions --- as a challenge to myself to learn more about the > Python > > import mechanisms. > > > > See https://github.com/bfroehle/pydzipimport. > > Apologies for hijacking the thread, but it's interesting that you > implemented your hook like this. I notice that you didn't use any of > the importlib functionality in doing so. Was there a particular > reason? I ask because a few days ago, I was writing a very similar > importer, as I wanted to try a proof of concept importer based on the > new importlib stuff (which is intended to make writing custom > importers easier), and I really struggled to get something working. > Struggling how? With the finder? The loader? What exactly were you trying to accomplish and how were you deviating from the standard import system? > > It seems to me that the importlib documentation doesn't help much for > people trying to import path hooks. There is a bug to clarify the docs to have more geared towards writing new importers instead of just documenting what's available: http://bugs.python.org/issue15867 > But it might be just me. Does > anyone have an example of a simple importlib-based finder/loader? Define simple. =) I would argue importlib itself is easy enough to read. > That > would be a huge help for me. In return for any pointers, I'll look at > putting together a doc patch to clarify how to use importlib to build > your own path hooks :-) > Do you specifically mean the path hook aspect or the whole package of hook, finder, and loader?
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com