Michael Hudson wrote: > I've not really been following this discussion with utmost care, but > the name "meta_path" doesn't move me. Wouldn't sys.importers be > better name? Or maybe I'm misunderstanding it's intent -- which is > still an argument for a better name. I don't like the name much either, but it _does_ fit quite well as the idea is that sys.path importing gets invoked through an item on meta_path. Perhaps this sketch helps a little: sys.meta_path = [ BuiltinImporter(), # handles builtin modules FrozenImporter(), # handles frozen modules PathImporter(), # handles sys.path ] def find_module(fullname, path=None): for i in sys.meta_path: l = i.find_module(fullname, path) if l is not None: return l return None class PathImporter: def find_module(self, fullname, path=None): if path is None: path = sys.path for p in path: i = get_path_importer(p) # deals with sys.path_hooks & cache if i is not None: l = i.find_module(fullname) if l is not None: return l retun None This is how you should look at it, even though it doesn't match the implementation (yet). Right now you should imagine those three objects on meta_path as an implicit extension of sys.meta_path, they don't yet physically exist. This should change in the near future, perhaps even with 2.3a2. 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