4 Dec
2002
4 Dec
'02
11:52 a.m.
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(...)
That, or what Jack said, which I think is even better: #5 for path in sys.path: if hasattr(path, "find_module"): loader = path.find_module(name) if isinstance(path, types.StringTypes): do_standard_import(...) else: pass (I originally thought it might be important that path elements be str subclasses, but I'm not so sure anymore. Especially after I wrote a str subclass in C: it's a HUGE pain ;-) Just