import statement suggestion/question

Fredrik Lundh effbot at telia.com
Sun Feb 6 23:18:56 CET 2000


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...).

for more on this topic, see the archives.

</F>





More information about the Python-list mailing list