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

Guido van Rossum guido@python.org
Thu, 17 Feb 2000 12:27:54 -0500


> However, we still have a tension occurring here:
> 
> 1) implementing policy in ImportManager assists in single-point policy
>    changes for app/rexec situations
> 2) implementing policy in Importer assists in package-private policy
>    changes for normal, operating conditions
> 
> I'll see if I can sort out a way to do this. Maybe the Importer class will
> implement the methods (which can be overridden to change policy) by
> delegating to ImportManager.

Maybe also think about what kind of policies an Importer would be
likely to want to change.  I have a feeling that a lot of the code
there is actually not so much policy but a *necessity* to get things
working given the calling conventions for the __import__ hook: whether
to return the head or tail of a dotted name, or when to do the "finish
fromlist" stuff.

> > (This also suggests that the relationship between the ImportManager
> > and the _FilesystemImporter should be more loosely coupled.)
> 
> Per a suggestion from MAL, I'm going to allow a user to pass <fs_imp> at
> ImportManager construction time. If you write a custom ImportManager, then
> you can pass in your own fs_imp when you instantiate it. I'll also move
> the default class (_FilesystemImporter) into a class variable.
> 
> Is that the uncoupling you were thinking of?  (we're also uncoupling the
> suffixes stuff somewhat)

Great!

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