Phillip J. Eby added the comment:

Hope I'm not too late to the bikeshed painting party; just wanted to chip in 
with the suggestion of "self-contained package" for non-namespace packages.  
(i.e., a self-contained package is one that cannot be split across different 
sys.path entries due to its use of an __init__ module).

Also, technically, namespace portions do not only contribute subpackages; they 
can contribute modules as well.

Another point of possible confusion: meta finders and path finders are both 
described as "hooks", but this terminology seems in conflict with the use of 
"hook" as describing a callable on path_hooks.  Perhaps we could drop the term 
"hook" from this section, and retitle it "Import System Extensions" and say you 
can extend the system by writing meta finders and path entry finders.  This 
would let the term "hook" be the exclusive property of path_hooks, which is how 
you extend the import system to use your custom finders.

The statement about __path__ being a list is also out-of-date; as of PEP 420, 
it can be an immutable, iterable object.  Specification-wise, __path__ need 
only be a re-iterable object, and people reading its value must NOT assume that 
it's a list or even indexable.

The term "sys path finder" should also be replaced by "path entry finder".  The 
former term is both incorrect and misleading, as it both implies that such a 
finder actually searches sys.path, and that it is exclusive to sys.path.  Path 
entry finders are used to look for modules within a location specified by a 
"path entry" - a string found in sys.path or in a __path__ attribute.

The term "path importer" is also horribly confusing in context...  after some 
reflection, I suggest the following additional terminology changes:

1. Replace "meta path finder" with "import handler"
2. Replace "path importer" with "sys.path import handler"

Now we can say that you extend the import system by adding import handlers to 
sys.meta_path, and that one of the default handlers is the sys.path import 
handler, which processes imports using sys.path and module __path__ attributes.

The sys.path import handler can of course in turn be extended by adding path 
hooks to sys.path_hooks, which are used to create module finder objects for the 
path entry strings found in sys.path and module __path__ attributes.  A path 
hook must return a finder object, which implements similar methods to those of 
an import handler, but with some important differences.

Whew.  It's a bit of a mouthful, but I think that this set of terms would keep 
all the roles and functions clear, along with their relationships to one 
another.  In addition, I think it provides greater clarity as to which pieces 
you need to extend when, why, and how.

What do you think?

----------
nosy: +pje

_______________________________________
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