[Numpy-discussion] Numeric3

Chris Barker Chris.Barker at noaa.gov
Tue Feb 8 14:34:32 EST 2005


Gary Strangman wrote:

> Konrad hits the nail on the head, IMHO. I use interactive mode ALL the 
> time (as would many converts from, e.g., Matlab). Lots of additional 
> typing would greatly limit the usefulness of interactive mode and, for 
> me, discourage use of python for numerics.

We all have different styles, but I was a user of Matlab for years, and 
maybe it's because I'm not a very fast typist, but when I found myself 
writing more than three lines at the prompt, I'd kick myself, and open 
an editor, and write a script. The one thing I found a little lacking 
when I started using python was an easy way to run a script inside an 
interactive session:

execfile("filename.py")

is a bit clunky. However:

$ python -i filename.py

Is not so bad at the command prompt, when all you have to do is hit the 
up-arrow key and run it again.

>> I suppose few of us 
>> would want to write x.sin() instead of sin(x).

Well, that's true for me also, but for structural array stuff, methods 
seem to make more sense. Besides, I'd get used to x.sin(), and like it 
if it kept my namespaces uncluttered!

as for the array() literal: how often do you really need to put in your 
arrays as a literal? I usually calculate, load from a file, generate 
randomly, or use arange(). And if I do type in an array literal, the 
extra typing of "array" is pretty small compared to typing all those 
numbers!

> And, if there's any desire to attract folks from (e.g.) Matlab (maybe 
> there isn't), a function-style approach is needed. This wouldn't have to 
> be the *only* implemented approach, but I would strongly (+10) favor 
> having the function notation available.

This is the approach taken by John with matplotlib. Inside, everything 
is all OO style, but with the "pylab" module creating a bunch of 
matlab-style helper functions. In fact, it's "officially" recommended 
that you use the pylab interface for interactive use, and the OO 
interface for "programming". Unfortunately, the OO interface lacks a 
number of useful features that really has nothing to do with OO vs. 
functional, it's just that the focus has been on easy usability for the 
pylab interface, but not for the OO interface. I've been working to 
change that (mostly just by complaining, but I intend to contribute code 
soon: I promise, really!)

So, in short, I'd like to see both: an internal OO structure, with a 
"interactive" helper module.

-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