[Python-Dev] New Import Hooks PEP, a first draft (and req. for PEP #)

Aahz aahz@pythoncraft.com
Thu, 19 Dec 2002 18:24:54 -0500


First of all, excellent job!  I've been feeling somewhat frustrated by
the number of directions this discussion has taken, and I'm glad to have
something that's clear and understandable.

One typo nitpick, one real question:

On Thu, Dec 19, 2002, Just van Rossum wrote:
>
>     - The __file__ attribute must be set.  This must be a string, but it
>       may be a dummy value, for example "<frozen>".  The priviledge of
>       not having a __file__ attribute at all is reserved for builtin
>       modules.

"privilege"

>     sys.path_hooks is a list of callables, which will be checked in
>     sequence to determine if they can handle a given path item.  The
>     callable is called with one argument, the path item.  The callable
>     must raise ImportError if it is unable to handle the path item, and
>     return an importer object if it can handle the path item.  The
>     callable is typically the class of the import hook, and hence the
>     class __init__ method is called.  (This is also the reason why it
>     should raise ImportError: an __init__ method can't return anything.)

Any reason we can't require importer objects to be new-style classes,
which could then use __new__?  (I vaguely recall some discussion about
this, but it should be documented in the PEP.)
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy@lion.austin.ibm.com