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
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