Things to address for Py3K

Christopher Barker Chris.Barker at noaa.gov
Wed Oct 11 16:34:02 CDT 2006


Travis Oliphant wrote:
>> 3) Inclusion of an nd-array type in the standard lib!
>> (or at the very least, an nd-array protocol)
>>
> Work on an nd-array protocol to extend the buffer protocol is occurring 
> right now.  It think this will be better in the end then a standard 
> nd-array type. 

Well, yes, if you have to choose just one. I'd like to see both.

> I think a multi-dimensional object array would at least be a nice step.

Me too. n-d slicing is so handy.

> There are enough differences between lists and 1-d arrays though, that 
> I'm not sure the accepted multi-dimensional object array would just be 
> the NumPy version.  

I guess the question is whether the goal is an n-d list or an n-d array. 
The key difference that I see is that numpy arrays are not re-sizable. 
But I have to wonder how practical it is to make an nd-array re-sizable, 
and, indeed, how that would work. I'm not sure what the n-d version of 
append() would be.

Numpy provides three things that I think are key:

1) An n-d array data structure. These are very useful for lots of things 
where an multi-dimensional data structure just makes sense. For these 
cases, you need the object array type (class?), and  n-d slicing.

2) array arithmetic: I'm a big fan of list comprehensions, but:

A = [x * 2 for x in B]

really is a LOT klunkier, and far less clear, than:

A = 2 * B

or even worse:

A = []
for x in B:
     A.append(2*x)

While array arithmetic is often seen primarily as a performance 
advantage (which, of course, it is) I also think it is a real boon to 
clear, error-free coding, and Python could use that.

3) A bunch of other really "mathy" or "scientific" functions:
(looking in the numpy book here)

polynomial functions
set operations (hmm -- there is a Python set type)
bessel functions
smoothing windows
fft
llinalg
etc.
etc.

These really do belong in numpy (scipy?), rather than the standard lib.

However this turn out, thanks for keeping numpy in the py3k loop.

-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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list