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

Guido van Rossum guido@python.org
Thu, 17 Feb 2000 09:56:32 -0500


> You're falling right back into the classic import hook problem. If MAL
> alters ImportManager and installs it, then he blows away whatever TP has
> done.

Fair enough.

I believe I was thinking of exactly the situations you were mentioning
later: in legitimate situations where the policy needs to be changed,
such as rexec or a closed app, it would be helpful if the policy was
all implemented as part of ImportManager.

The importers shouldn't typically deal with the policy: they are there
to deal with the intricacies of importing code from a particular
archive format, or from the web (e.g. webDAV :-), or from a database
or version control management system.

If I have a legitimate situation (see above) where I need to change
the policy, I want to be able to subclass one class.  With the current
architecture, I would need to subclass each of the importer classes
that I am using to change the policy.  Instead, I want to be able to
change the ImportManager and hook it up with the existing importers.

(This also suggests that the relationship between the ImportManager
and the _FilesystemImporter should be more loosely coupled.)

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