Nick Coghlan added the comment:

As far as the path importer goes, it's important to keep in mind there are 
*four* different pieces in play:

1. The path importer itself

This is a meta path finder installed on sys.meta_path, which implements the 
find_module API. It scans the supplied search path (or sys.path) for path 
entries, using sys.path_importer_cache and sys.path_hooks to find the locate 
path entry finders. "Path importer" is an eminently appropriate name as it is 
responsible for *all* of the standard semantics of sys.path and package 
__path__ attribute processing. It could be potentially be qualified with 
"standard path importer" or "default path importer" to distinguish it from 
other cases.

2. The path hooks

These are installed in sys.path_hooks, and are simply callables that accept a 
path entry and return an appropriate path entry handler or else raise 
ImportError. The specification is designed to make it easy to use the classes 
for path entry handlers directly as path hooks (since __init__ can throw 
ImportError, but it can't return None). For these, "path hook" is just fine as 
a name.

3. The path entry handlers

These are the objects returned by the path hooks. Historically, they 
implemented find_module() (without the second "search path" parameter), and now 
they can implement the "find_loader()" API instead.

The reason I don't like "sys path finder" for these is that it misses their 
essential role in handling package __path__ attributes. I have previously 
suggested "path entry finder", but that's a little ambiguous (since it suggests 
they're tools for *finding* path entries, rather than tools for finding module 
loaders *given* a path entry). Thus, my new suggestion here: "path entry 
handler". They're objects that handle particular path entries on behalf of the 
path importer, so the name is perfectly appropriate, and better distinguishes 
them from the meta path finder objects.

4. The module loaders

As with any import, the module loaders implement the load_module() API to 
create, cache, initialise and return a loaded module object.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to