[Python-3000] Changing the import machinery
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Apr 22 02:43:45 CEST 2006
Phillip J. Eby wrote:
> So, what I'd suggest is that the expanded import mechanism would provide a
> registry of extensions and handlers,
Urg, global registries again.
I'd like this better if the scope of a particular extension
and its handler could be restricted to some chosen part of
the package namespace. So the author of the 'grail' package
can specify a handler for his special '.nun' files, but it
only applies to imports within the 'grail' package, and
can't conflict with anyone else's registration of a handler
for the same extension in other places.
Perhaps the handlers pertaining to a package could be
attached to the module object for that package, in an
__importers__ attribute or something like that. Then,
when looking for a handler for a particular file, a
search is made upwards from its containing package
looking for a handler that matches it.
--
Greg
More information about the Python-3000
mailing list