adding an attribute to an nd-array

Stefan van der Walt stefan at sun.ac.za
Thu Oct 19 18:09:44 CDT 2006


On Thu, Oct 19, 2006 at 01:59:49PM -0700, 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?

Looks like

x = N.array([1,2,3])
x.view(InfoArray)

works.

Thanks to everyone for the useful feedback!

Cheers
Stéfan

-------------------------------------------------------------------------
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