[Python-Dev] imputil and modulefinder replacements

Gordon McMillan gmcm@hypernet.com
Fri, 5 Oct 2001 07:58:05 -0400


Thomas,

> Some comments:
> To fully simulate python's behaviour for import, the case of the
> filename must be checked on windows.

True. Sigh.

> I found only two
> possibilities to do this - the first one is to use os.listdir()
> which is probably expensive, but it returns filenames with the
> actual case. Second would be to use Mark's win32api.FindFiles(),
> but this may not be available.
> 
> Your metapath models Python's import policy. One part of the
> policy is that already loaded modules are fetched from
> sys.modules instead of imported again. Should this behaviour also
> be modeled by a SysModulesCacheDirector on your metapath?

That's already done by the ImportManager as soon as he's got 
a candidate fqname.
 
> What about reload? Shouldn't a new import-util module also
> implement a reload-replacement?

Yes, it should.
 
> > I would like to propose these (or something quite like them) as
> > replacements for the official versions. The code is quite
> > similar (in fact, the modulefinder code could have been written
> > by subclassing the imputil stuff, but I wrote them the other
> > way 'round). 
> > 
> It seems noone cares about this. imputil is in the distribution,
> but is it really 'official'?

The entire subject seems to have dropped off radar, after 
starting out as highly controversial (the Import-SIG was started 
so the ihooks-partisans could hash it out with the imputil-
partisans). Import hacks are more common than ever, but 
they're all home-grown now.

- Gordon