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/2002-December/030912.html below:

[Python-Dev] New and Improved Import Hooks

[Python-Dev] New and Improved Import Hooks [Python-Dev] New and Improved Import HooksJust van Rossum just@letterror.com
Fri, 6 Dec 2002 15:55:25 +0100
Guido van Rossum wrote:

> > > I'm not sure if the two-step approach is a big enough deal to
> > > keep it in a new import scheme.
> > 
> > does anyone remember/know why it was done in two steps?
> 
> So you can check whether a module or package exists without importing
> it?

I have no idea how useful that is in practice.

> For the relative import ambiguity?

This is not true at find-module-time: if module x.y does "import z" two things
are tried:

    - Find 'z' on x.__path__
      We know up front that *if* that suceeds that the full name is "x.z",
      so you might as well attempt to *load* "x.y".

    if the above failed:
    
    - Find 'z' on sys.path, in which case the full name is "z".

It doesn't matter much, though, in that as long as we don't want to rewrite
import.c as a whole we're stuck with the two-step scheme anyway.

Just



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