A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-July/015787.html below:

[Python-Dev] Q: import logic

[Python-Dev] Q: import logicGuido van Rossum guido@digicool.com
Fri, 06 Jul 2001 11:48:03 -0400
> 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