[Python-Dev] Re: .DLL vs .PYD search order

M.-A. Lemburg mal@lemburg.com
Fri, 03 Dec 1999 15:24:04 +0100


Fredrik Lundh wrote:
> 
> MAL wrote:
> > > IMHO, we should retreat to a more centralized interface,
> > > one which more resembles a manager rather than the agent
> > > interface implemented in imputil.py. Add-ons can then
> > > register themselves to say "hey, I can handle pyz-archives"
> > > or "I know how to import .so modules" or "I provide a
> > > search function which you can call to have me scan
> > > my module container (directory, web-site, archive)".
> 
> but why?  in my small-minded view of how python
> works, an importer carries out a very simple task:
> 
>     given a name, check if you have a
>     module with that name, and install
>     it.  if you cannot, fail (in which case
>     python asks the next importer along
>     the path).
> 
> why do you have to complicate things beyond that?
> why not just let Python provide a few base classes
> and mixins for people who want to create custom
> importers, and be done with it?

Because importing in Python has become *much* more
complicated over time. There are requests for new
features which touch subjects such as storage mechanisms,
lookups, signatures (for trusted code), lazy imports, etc.

A chain of simple minded importers won't work together
too well, duplicate work and downgrade performance
considerably due to the many recursive function calls.
Also, centralized caching strategies are hard to implement
across import handlers.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    28 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/