[Python-Dev] Zipping Zope3
Just van Rossum
just@letterror.com
Wed, 18 Dec 2002 16:55:13 +0100
Samuele Pedroni wrote:
> Question: how does the patch respectively PEP features interact with
> imp module?
Sneak preview from the PEP (glad I already wrote that part ;-):
"""
imp module integration
The new import hooks are not easily integrated in the existing
imp.find_module() and imp.load_module() calls. It's questionable whether
it's possible at all without breaking code; it is better to simply add a
new function to the imp module. The meaning of the existing
imp.find_module() and imp.load_module() calls changes from: "they expose
the builtin import mechanism" to "they expose the basic *unhooked*
builtin import mechanism". They simply won't invoke any import hooks. A
new imp module function is proposed under the name "find_module2", with
is used like the following pattern:
loader = imp.find_module2(fullname, path)
if loader is not None:
loader.load_module(fullname)
In the case of a "basic" import, one the imp.find_module() function
would handle, the loader object would be a wrapper for the current
output of imp.find_module(), and loader.load_module() would call
imp.load_module() with that output.
Note that this wrapper is currently not yet implemented, although a
Python prototype exists in the test_importhooks.py script (the
ImpWrapper class).
"""
It needs to be fleshed out a bit more, but this is the basic idea.
Just