[Python-Dev] Q: import logic

Samuele Pedroni Samuele Pedroni <pedroni@inf.ethz.ch>
Fri, 6 Jul 2001 17:22:58 +0200 (MET DST)

Hi. I have looked at CPython import logic (C code) ...

is the following true (ignoring relative import issues and None markers):

trying to import s.p.a.m the logic checks for:


in sys.modules in this order until it finds an already present module and starts the effective
loading from there.

Is that an implementation detail, or should be considered an important semantic aspect.

Jython has a different logic but then some tricky python code (substituing packages with classes)
can incur in inf recursion.

Thanks, Samuele Pedroni.