[Python-Dev] PEP 328 and __import__ contract

Samuele Pedroni pedronis at bluewin.ch
Tue May 11 15:45:00 EDT 2004


PEP 328 seems at the moment to only describe the syntactic, surface and 
as-seen-by-the-user
aspects of the new behavior for absolute/relative imports.

What is going to happen to __import__ hook?

At the moment relative imports as the default are implemented at that level,
through get_parent and the first load_next in import_module_ex which is 
exported as __import__.

Will imports still be implemented in terms of/on top of __import__.

What will be the contract for __import__ then?
I suppose it could be kept the same, relaxing over time the obligation to 
implement
relative imports. At the moment a __import__ hook can be forced in absolute 
import mode
by passing an empty globals dict.

I think the PEP should cover some of this.

regards.





More information about the Python-Dev mailing list