[Python-Dev] New and Improved Import Hooks (original) (raw)
Just van Rossum just@letterror.com
Tue, 3 Dec 2002 21:45:35 +0100
- Previous message: [Python-Dev] New and Improved Import Hooks
- Next message: [Python-Dev] New and Improved Import Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Samuele Pedroni wrote:
From: "Just van Rossum" <just@letterror.com> > I will change my zipimport hook (which still isn't finished ;-) to also > traverse sys.path, and check for *.zip path endings. >
my point was that, given dir1;zip0;dir2 dir1 should take over zip0 that should take over dir2. [This is what Jython 2.1 does btw] If the resulting import precedence order is that both dir1 and dir2 take over zip0, then maybe allowing zip0 in sys.path is just confusing, and zipfiles should be specified elsewhere.
True, true.
Does Jython implement the (old) idea that items on sys.path can be import handler objects? (If yes, can you briefly describe the interface of these objects?)
After seeing what you mean I think that may be the only sensible solution.
Say:
for p in sys.path:
if hasattr(p, "find_module"):
x = p.find_module(...)
elif not isinstance(p, basestring):
continue
else:
x = builtin_find_module(...)
...load module...
Just
- Previous message: [Python-Dev] New and Improved Import Hooks
- Next message: [Python-Dev] New and Improved Import Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]