Gustavo Niemeyer <niemeyer@conectiva.com> writes: > > It appears that this can't be really done with the proposed mechanism, > > as you want to have a multiple hooks for a single source "URL". > > As you have mentioned below, all hooks registered are called, if > the previous ones failed. So there shouldn't be any problem. I mentioned this as a theoretical architecture which is not going to be implemented by Just. Whether or not this is a problem, I don't know. > > So you are back to calling all registered hooks for all items on > > sys.path, which might be expensive. > > Agreed. But further hooks are only called if the default one failed. Again, this is *not* the strategy that Just proposes, and, unless somebody provides an implementation of it, not one that will matter. As for "only called if the default one failed": This will be the normal case. In my standard installation, sys.path is ['', '/home/martin/work', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2', '/usr/local/lib/python2.3/lib-tk', '/usr/local/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/local/lib/site-python'] So if I have 5 import hooks (including the default one), and I do "import Fnorb" (which is in site-python), I get 36 hook calls before the Fnorb package is found. For each element in sys.path, first the default hook will fail, and then all additional hooks, then it proceeds to the next element of sys.path. Quite expensive, potentially. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4