questions about imports and classes

Gordon McMillan gmcm at hypernet.com
Mon Apr 24 18:43:45 CEST 2000


Tim Iskander wrote:

> 2 - has there been any/much discussion on extending the import
> command to allow
>         renaming the module at import time,
>         ie: import myLongWindedModuleName as myShortName
> 
>         using the (new) keyword "as" to rename the module. We are
> dealing with a multi
>        developer, multitask application using lots of python
>        modules and
> we would like to
>         give the files non-ambiguous names without having unruly
>         module
> names in our code.

Until (if) we get "as", my advice is keep it simple.

import ModuleWithAReallyStupidLongName
SLN = ModuleWithAReallyStupidLongName
SLN.somethingorother()

> p.s. I am not very vi - literate and cannot get it to use spaces
> instead of tabs for autoindent... I will go and read the FAQ
> etc... but if its a simple answer that someone can send me I'd be
> really happy :-)
> 
A minimal .vimrc file would be

set expandtab
set sts=4
set shiftwidth=4

Now hitting the tab key will give you 4 spaces.

- Gordon




More information about the Python-list mailing list