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/030798.html below:

[Python-Dev] New and Improved Import Hooks

[Python-Dev] New and Improved Import HooksSjoerd Mullender sjoerd@acm.org
Thu, 05 Dec 2002 13:55:25 +0100
On Thu, Dec 5 2002 Martin v. =?iso-8859-15?q?L=F6wis?= wrote:

> "M.-A. Lemburg" <mal@lemburg.com> writes:
> 
> > Well, that's what I tried to solve in the sketch I posted earlier
> > (slightly modified to meet Fredrik's requirements):
> > 
> > 1. User programs register import hooks based on suffixes which are
> >     used to match the entries in sys.path, e.g. ".zip" for
> >     ZIP importers (caching could help in improving the mapping
> >     performance; this is where the auxilliary dictionary comes into
> >     play).
> 
> I don't like this idea. How could I then make a HTTP importer, where
> no suffix is available?

Instead of a regexp, I would suggest using a function that returns
true if the hook can deal with the path component.  This function
could then use a regexp to determine whether it can.  But this is
about the same complexity as just calling the hook and let it return
quickly if it can't deal with the path component.

So this step would just become:
1. User programs register import hooks.

-- Sjoerd Mullender <sjoerd@acm.org>



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