[Python-Dev] imputil modifications

Gordon McMillan gmcm@hypernet.com
Mon, 20 May 2002 10:03:20 -0400


On 19 May 2002 at 17:24, Dave Hawkes wrote:

> Recently I tried to use the imputil and module and
> noticed that it had a few shortcomings, particularly
> in an environment like pythonwin. 
> 
> I implemented a few changes/additions (applicable
> to python 2.2 and up) to imputil (attached in
> newimputil.zip) to fix these problems, without
> breaking its basic structure. 

I'd suggest you check out iu.py (see
http://www.mcmillan-inc.com/iu.html).
 
> Issues addressed:
> 
> 1) Objects in sys.path can break some other modules.
 
In iu, sys.path contains strings.
 
> 2) Chaining to previous (foreign) import handlers
> supported if desired.

No chaining, but iu is a complete import replacement.
There are a couple levels at which you can override
or extend it.

> 3) reload is implemented.

iu has reload. Also has an import lock. Also puts
None is sys.modules on failure (as builtin import
does, but not imputil). Also faster.

-- Gordon
http://www.mcmillan-inc.com/