Re: module names and import

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Thu, 9 Dec 1993 16:10:31 -0500

On Dec 9, 12:18, Doug Moen wrote:
> For example,
> import Grass.Window
> The imported module is bound to the last identifier in the module name.
> Eg, 'Grass.Window' is bound to 'Window'.
>

I would suggest that the module be bound to Grass.Window and not
Window, as it is easier to _flatten_ the namespace
( import Grass.Window; Window = Grass.Window; del Grass )
than it is to expand it. A possible shorthand for the above
could be "import Grass.Window as Window" .

Also: import Grass.* could import all modules contained in or below
directory (one of: $PYTHONPATH)/Grass.

I'll comment in more detail after I've fully digested your proposal,
but in general, I would hope for a more minimal solution: i.e. just
enough to fix the problems with import, but not any more complicated.
( I'm not saying your proposal ISN'T the minimal solution - but it
doesn't hit me as minimal on the first read. )

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics