[Numpy-discussion] Numeric3

Chris Barker Chris.Barker at noaa.gov
Tue Feb 8 17:08:19 CST 2005


Ralf Juengling wrote:
>>>from scipy import *
>>
>>And I'd like to see this deprecated.
> 
> I don't understand what's wrong with this. (Of course, the module
> you do the "from XXX import *" with should be designed for this).

If it's designed for this, then none of the names will clash with 
built-ins, unless intended. However, what about other modules that might 
also be done as "import *"?

It seems to me that the assumption is that whatever module is imported 
that way will be the only one imported that way. This is not always the 
case. Also, what if you need to import a module that happens to have the 
same name as an attribute of the "import *" one. You can do an "import 
as", but only if you know you have a name clash.

> Name space pollution is not an issue, because when you write 
> programs, you don't do "from XXX import *". 

Ha! That's the core problem here. As an example (I don't mean to be 
picking on you, John) matplotlib docs suggest that you do things 
differently when writing programs than playing with the interpreter. 
However, almost all of the examples and docs, and and most of the 
usability effort has gone into the "import *" approach. The same is true 
for Numeric and numarray. Why would someone magically stop using it? 
Besides, I use the interactive interpreter to try out code that I'm then 
going to use in a program. Why have a different syntax?


"Namespaces are one honking great idea -- let's do more of those!"

Note, that's "more", not "less"

OK, I'll stop ranting now.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the Numpy-discussion mailing list