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

[Python-Dev] New and Improved Import Hooks

[Python-Dev] New and Improved Import Hooks [Python-Dev] New and Improved Import HooksFredrik Lundh fredrik@pythonware.com
Wed, 4 Dec 2002 11:33:05 +0100
Jack Jansen wrote:

> > Regarding sys.import_hooks, I see three possibilities:
> >
> > #1
> >     for p in sys.path:
> >         for hook in sys.import_hooks:
> >             hook(p, ...)
> >
> > #2
> >     for hook in sys.import_hooks:
> >         for p in sys.path:
> >             hook(p, ...)
> >
> > #3
> >     for hook in sys.import_hooks:
> >         # the hook can traversing sys.path if needed.
> >         hook(...)

what's wrong with:

#4
    for path in sys.path:
        if isinstance(path, types.StringTypes):
            do_standard_import(...)
        else:
            path.do_import(...)

after all, everyone knows how the path works, and everyone knows how
to manipulate sys.path inside a Python program.

(for PIL and other plug-in architectures, a "path.get_list_of_modules"
method would also be nice).

</F>




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