[Python-Dev] Another approach for the import mechanism
Gordon McMillan
gmcm@hypernet.com
Fri, 6 Dec 2002 12:11:32 -0500
On 6 Dec 2002 at 12:18, Martin v. L=F6wis wrote:
> - Wait for YAGNI (yet another great new
> infrastructure), to invoke all hooks on all sys.path
> items; this would give backwards compatibility
> (sys.path could continue to be a list of strings),
> extensibility (you could add new strings to
> sys.path, yet the hooks would honor them),
> feature-richness (you can implement a .py.bz2
> importer), and slowness (for invoking every hook on
> every sys.path item).
A .py.bz2 importer is an example of what Greg
Stein called a "suffix importer". That's orthogonal
to "path importer"s. I omitted "suffix importer"s from
iu, precisely because of the slowness. If you
limit yourself to hooking nodes on sys.path (or
on __path__), a pure Python __import__ can
beat the builtin import (if you use efficient
archives).
-- Gordon
http://www.mcmillan-inc.com/