Maintainability (was Re: Stackless & String-processing)

Ivan Van Laningham ivanlan at callware.com
Fri Jul 23 11:36:49 EDT 1999


Hi All--

"Fred L. Drake" wrote:
> 

[bobbitt]

>   Yes.
>   Something that I'd like to see, that I don't think has been
> mentioned for a long time, is some sort of "import ... as" statement.
> I like qualifying the names from a module, but if I'm using them a lot
> I want to give the module a short name.  For instance,
> 
>         import Tkinter as Tk
> 
> would be more comfortable, and is much more clear than:
> 
>         import Tkinter
>         _tk = Tkinter
>         del Tkinter
> 
>   Variants could include:
> 
>         import package.module as pkgmod # pkgmod is the actual
>                                         # module, not the package
> 
>         from package import module as pkgmod
>                                         # the same, possibly cleaner
> 
>         from module import function as func
> 
>   As I said, I haven't noticed this come up for a while, so maybe I'm
> the only one, but I think this would encourage clarity and
> "localizing" the names of imported modules (adding a leading _ so when
> others "import *" from our modules their namespace isn't polluted too
> much).
> 

Now, this I like.  I haven't seen this proposal before (or maybe I have
and senility is setting in), but you can now count me in as a proud
supporter of this idea.

Any reason it couldn't be done?  What bad things would happen if this
were implemented and "from spam import *" went away?

<except-for-import-spam-as-foo-will-silently-dump-core,-nothing>-ly
y'rs,
Ivan;-)
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also: 
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
----------------------------------------------




More information about the Python-list mailing list