import statement suggestion/question
michael at camelot-it.com
Mon Feb 7 09:23:04 CET 2000
Fredrik Lundh wrote:
> Kannan Vijayan <kvijayan at csclub.uwaterloo.ca> wrote:
> > 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.
> this has been suggested many times before.
> the usual counter argument is that those lengthy
> prefixes makes your code much easier to read, and
> that allowing arbitrary renaming is a great way to
> confuse the hell out of people (explicit renaming
> using assignments are pretty bad style, imho...).
You can easily do the same in Python WITHOUT these changes, e.g. instead of
you can use
del VijayanModule_Doing_A_B_C # can be omitted
I'm not sure it is worth changing the language in order to save one line of code and make it less
More information about the Python-list