[Python-Dev] New universal import mechanism ( Re: [Python-checkins] python/dist/src/Python import.c,2.210,2.211)

Greg Ward gward@python.net
Mon, 2 Dec 2002 12:06:09 -0500


On 02 December 2002, Just van Rossum said:
> I've been doing some thinking about the import mechanism, too, and my
> current gripe is about the __import__ hook: I find it utterly useless
> that the implementer of the hook is supposed to deal with
> sys.modules. What I wish for is a hook that only gets invoked if the
> module isn't already in sys.modules.

I can see where you're coming from, but one disadvantage to your scheme
is that it would not be possible to override .py/.pyc/.pyo files -- they
would always be imported in preference to any other scheme.  This could
well be a feature.  ;-)

        Greg
-- 
Greg Ward <gward@python.net>                         http://www.gerg.ca/
What happens if you touch these two wires tog--