adding an attribute to an nd-array

Travis Oliphant oliphant at
Thu Oct 19 18:00:38 CDT 2006

Christopher Barker wrote:

>Travis Oliphant wrote:
>>Actually something as simple as
>>class InfoArray(N.ndarray):
>>         pass
>>will allow you to add attributes to InfoArray.
>Well, sure, but how the heck do you initialize it?
You use the same constructor as ndarray has.

If you want an array-like function that produces the array, you do


or wrap that up in your own function.

There are many over-lapping ways to construct ndarray's.   You can use 
all of these ways to construct instances of your own type by getting the 
ndarray and using the .view() method.


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

More information about the Numpy-discussion mailing list