Greg Stein wrote:
M.-A. Lemburg wrote:
... Anyway, the dynamic and static versions are both implementable using the hook, so I'd opt for going into that direction rather than hard-wiring some logic into the interpreters core.
IMO, the interpreter core should perform as little searching as possible. Basically, it should only contain bootstrap stuff. It should look for a standard importing module and load that. After it is loaded, the import mechanism should defer to Python for all future imports. (the cost of running Python code is minimal against the I/O used by the import)
IMO #2, the standard importing module should operate along the lines of imputil.py.
You mean moving the whole import mechanism away from C and into Python ? Have you tried such an approach with your imputil.py ?
I wonder whether all things done in import.c can be coded in Python, esp. the exotic things like the Windows registry stuff and the Mac fork munging seem to be C only (at least as long as there are no core Python APIs for these C calls).
And just curious: why did Guido recode ni.py in C if he could have used ni.py in your proposed way instead ?