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/030769.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
Thu, 5 Dec 2002 10:41:20 +0100
M.-A. Lemburg wrote:

> Why not leave sys.path as list of ordinary strings and add
> all the extra support to the existing import mechanism via
> hooks at the right places ?!
> 
> E.g. such a hook may scan sys.path for files which end
> in '.zip' and then redirect the lookups into their ZIP
> archive directory.

Then you get the problem that Samuele pointed out: if the *hook* scans sys.path
you get a funny path resolution order: hooks[0] may find the module on
sys.path[3] before hooks[2] finds it on sys.path[2].

We should document that

- sys.path *may* contain arbitrary objects, and that sys.path traversing
  code should be careful.
- the std library promises to not add objects to sys.path that are not
  isinstance(p, (str, unicode)).

I think this is the perfect compromise. Thank you </F>!

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