[Python-Dev] New and Improved Import Hooks
Jack Jansen
Jack.Jansen@cwi.nl
Wed, 4 Dec 2002 12:15:37 +0100
On Wednesday, Dec 4, 2002, at 11:33 Europe/Amsterdam, Fredrik Lundh
wrote:
> what's wrong with:
>
> #4
> for path in sys.path:
> if isinstance(path, types.StringTypes):
> do_standard_import(...)
> else:
> path.do_import(...)
>
After reading Just's later message and the explanation about how Jython
does it
I think that my preference is now something like the "if hasattr(path,
'find_module')"
fix. This will allow you to use a subtype of strings on sys.path. Make
one
pass over sys.path replacing the zipfiles and other funnies by a
specialised
subtype of string.
--
- Jack Jansen <Jack.Jansen@oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -