import statement suggestion/question

Kannan Vijayan kvijayan at csclub.uwaterloo.ca
Sun Feb 6 16:34:45 EST 2000


One thing that annoys me about importing modules is the
usually-lengthy-prefix you have to add to each function/object
you handle

i.e:
import LongModuleName
LongModuleName.foo()
etc..

right now this can be somewhat alleviated by doing this:
import LongModuleName
LMN = LongModuleName
del LongModuleName
LMN.foo()

wouldn't it be easier to maybe modify the import statement itself
to something like this:

import LongModuleName as LMN
or to avoid using up reserved words
import LongModuleName(LMN)	
import LongModuleName:LMN

you get the idea.

it would allow people to get rid of the sometimes-annoyingly-long
module names, and still keep the code clean and easy to understand.

It would also help when you want to import modules, but keep them
hidden using the prefix _ notation.

-kannan
kvijayan at csclub.uwaterloo.ca



More information about the Python-list mailing list