[Import-sig] Re: Long-awaited imputil comments

Guido van Rossum guido@python.org
Wed, 16 Feb 2000 15:54:27 -0500


> [Guido]
> > > >         I think we need a hook here so that Marc-Andre can implement
> > > >         walk-me-up-Scotty; or Tim Peters could implement a policy that
> > > >         requires all imports to use the full module name, even from
> > > >         within the same package.

[Gordon]
> Hmm, after thinking about it, I can't see these as "import 
> hooks". At least, if you are installing these system-wide, 
> these are changing the semantics of "import", not grabbing 
> code from strange places, or transforming .xyz files into 
> Python or ...
> 
> I can have working code; now add some mxX or TP extension 
> and have existing code (not using the new extension) break.
> 
> OTOH, if MAL / TP provides an importer, and fixes that 
> importer to follow their preferred policy, that's fine; and I can 
> pretend that that's an "import hook".

Good point.

Fortunately, the proposed solution (reintroducing __domain__) lets
this be solved on a per-package basis.

Still, I want to be able to subclass ImportManager to change the
global policy; supporting __domain__ is an example of such a change of
policy.  I also want to avoid having to reimplement the policy, with
all its warts, in freeze.

--Guido van Rossum (home page: http://www.python.org/~guido/)