> 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: > > s.p.a.m > s.p.a > s.p > s > > 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. I'm not sure what alternative you had in mind, so I'm not sure how to answer this (fearing it is a trick question :-). This is supposed to look for s first, then s.p, then s.p.a, and then s.p.a.m. So exactly the opposite order of what you state! I hesitate to call this an implementation detail -- it really is intentional behavior that packages s, s.p, and s.p.a must be loaded and initialized before the import of s.p.a.m is attempted. Can you clarify the background of your question? --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4