Re: import module by filename

Daniel W. Connolly (connolly@hal.com)
Wed, 23 Mar 1994 10:22:37 -0600

In message <199403222341.AA18226@elvis.med.Virginia.EDU>, "Steven D. Majewski"
writes:
>
>Way Back, we had some discussion about the desire for changes or
>options to 'import' - either to import using an explicit path,
>bypassing the sys.path search sequence, or to import a module
>under a different name.

Was there any discussion of adopting the "import x as y" sytax ala
Modula-3? It seems to me that after a while, the namespace of modules
gets just as messy as the namespace of function names.

With the "import x as y" syntax, authors would be free to make the
global names of their modules long and descriptive. For example, I'm
developing a URI module, but I suspect other folks are to. I'd like
to be able to distribute it as, e.g. "connolly_uri.py" and have folks
write:

import connolly_uri as URI

abc = URI.absolute('http://host/foo/bar')
fp = abc.open()

Dan