nested scopes

Nathaniel Gray n8gray at caltech.edu.is.my.email.address
Tue Feb 6 03:00:47 EST 2001


D-Man wrote:

> On Mon, Feb 05, 2001 at 02:01:58AM -0800, Nathaniel Gray wrote:
> | 
> | Interesting issue.  What if the following was allowed:
> | >>> from tim_bot_module import tb*
> | 
> 
> Hmm, wouldn't it be better to use :
> 
> >>> import tim_bot_module as tb
> >>> tb.name_you_want_to_use
> 
> ?
> 
> IMO prefixing names with strings like "tb" is for namespace-less
> languages like C.  Since python has namespaces, why not use them?
> 

Yes, that would be the preferred method, but there are modules (TKInter, 
Numpy, wxPython) that are designed to be used with the "import *" idiom.  
This proposal would just allow you to use those modules without sacrificing 
efficiency.

I agree, though, that "import .. as .." goes a long way towards making 
"import *" unnecessary.

-n8

-- 
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._
             Nathaniel Gray
   California Institute of Technology
     Computation and Neural Systems
     n8gray <at> caltech <dot> edu
_.~'^`~._.~'^`~._.~'^`~._.~'^`~._.~'^`~._




More information about the Python-list mailing list